If you want to use the Handles
keyword, you can do so by defining your TextInput
as a field of your form (a variable at the form-level, outside of any method). You then need to add the WithEvents
modifier to the variable declaration, like this:
Public Class MyForm
Private WithEvents TextInput As New Scintilla
Private Sub Scintilla_CharAdded(sender As Object, e As ScintillaNet.CharAddedEventArgs) Handles TextInput.CharAdded
' ...
End Sub
End Class
If you can't define it as a field of your form, then you won't be able to use the Handles
keyword. In that case, you'd need to resort to using the AddHandler
and RemoveHandler
commands to register your event handler with the object.