Click event can not be found error

  • Thread starter Thread starter Cal
  • Start date Start date
C

Cal

I have textboxarray txtRatio and the following routine to handle the click
events.

Private Sub txtRatio_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles txtRatio.Click
Dim Index As Short = txtRatio.GetIndex(eventSender)
mlngHasFocus = mlngCODE_FOR_RATIO
mlngHasFocusIndex = Index
DoRatio()
End Sub

However the compiler gives the following error message:
Click event can not be found (for Handles txtRatio.Click)

Anyone know what's going on?

Thanks
Cal
 
Hi Cal,
Private Sub txtRatio_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles txtRatio.Click
Dim Index As Short = txtRatio.GetIndex(eventSender)
mlngHasFocus = mlngCODE_FOR_RATIO
mlngHasFocusIndex = Index
DoRatio()
End Sub

However the compiler gives the following error message:
Click event can not be found (for Handles txtRatio.Click)
I think you try to put the click event somewhere manual do you have that
code also?

Cor
 
Gidday,

If you have added this control manually you may have left off the WithEvents
keyword...

If you used the Forms Designer and dragged the control onto the form then
the VS IDE should have done this for you...

I sometimes find (since installing VS 2003) that sometimes even though the
control declaration and the click (or whatever) event are correctly coded,
VS.Net still can't seem to find it... then when you double click the control
it creates a new one but increments the name by 1 eg: Private Sub
txtRatio_Click_1(ByVal....

Which means VS.Net knows there is an existing sub but it ignores it and
creates a new one... haven't figured out why myself but been cauing me
problems for a while now...

Cheers
 
Thanks for the replies. I should have said that it was an update from VB6.
I couldn't fix it but IntelliSense gave me the option of doubleclick so I'll
use that for now.

Thanks
Cal
 
I have textboxarray txtRatio and the following routine to handle the click
events.

Is txtRatio the name of the array? AFAIK, an array does not have a click
event. How is txtRatio declared? If txtRatio is the name of the array,
then you need to use the AddHandler statement to attach each of the
textboxes in the array to the click handler.
 
Thanks for the interest



Friend WithEvents txtRatio As
Microsoft.VisualBasic.Compatibility.VB6.TextBoxArray
 
Back
Top