Click event can not be found error

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
 
C

Cor

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
 
B

Bob

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
 
C

Cal

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
 
C

Chris Dunaway

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.
 
C

Cal

Thanks for the interest



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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top