'compile error : procedure declaration does not match description of event or procedure having the same name
I have copied my entire vb6 code from one machine to another , now when i was running my code on another machine ,it shows error like : compile error : procedure declaration does not match description of event or procedure having the same name, This is the code :
Private Sub MKDataGrid1_KeyPress()
If MKDataGrid1.Col = 0 Or MKDataGrid1.Col = 1 Or MKDataGrid1.Col = 2 Or MKDataGrid1.Col = 3 Then
MKDataGrid1.AllowUpdate = False
MsgBox "This field is not to edit. Thnks"
MKDataGrid1.AllowUpdate = False
cmdAdd.visible = True
cmdAdd.SetFocus
cmdAdd.visible = False
Else
MKDataGrid1.AllowUpdate = True
End If
End Sub
Solution 1:[1]
It looks like your declaration for the event got messed up. Generally speaking, the KeyPress event takes the parameter KeyAscii As Integer. I recommend temporarily remarking out your routine and then selecting the KeyPress event manually from the dropdown in the code window. Then copy your previous content back into the KeyPress that VB inserted.
Solution 2:[2]
I have to register the vb6datagrid.ocx on my computer for this , i have register this .ocx on my machine , actually i have again copy the new code in my machine from my old machine and before runing it i have open Project >> components >> designers and from there selected the require components and have removed the unwanted , and then i have run the project so again i get the error but when i go to view object there again i find the object missing so i have placed the datagrid and then its running fine :)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | vbguyny |
| Solution 2 | user1787635 |
