I'm not sure I grasp the finer points of event calling and handling in vb.net. This code for example:
Sub TestEvents()
Dim Obj As New Class1()
' Associate an event handler with an event.
AddHandler Obj.Ev_Event, AddressOf EventHandler
Obj.CauseSomeEvent() ' Ask the object to raise an event.
End Sub
Sub EventHandler()
' This procedure handles events raised by the object Obj.
MsgBox("EventHandler caught event.") ' Handle the event.
End Sub
Public Class Class1
Public Event Ev_Event() ' Declare an event.
Sub CauseSomeEvent()
RaiseEvent Ev_Event() ' Raise an event.
End Sub
End Class
...should demonstrate how to start and stop eventhandling in your program. But I don't see in what case one can't just substitute the code pasted here with normal function calls.
On the other hand I have this problem. I want to open this form of mine. I have already written code for this, this code is executed by the menuitem miComentary click event.
But I want to execute this same code from another button in my program..can't I force the program to raise the miCommentary_click even somehow? I tried calling it as a normal function, but I have problem figuring out what the valid parameters should be (ByVal sender As System.Object, ByVal e As System.EventArgs)
well, thanks for reading this far
Yours truly
Daed
Sub TestEvents()
Dim Obj As New Class1()
' Associate an event handler with an event.
AddHandler Obj.Ev_Event, AddressOf EventHandler
Obj.CauseSomeEvent() ' Ask the object to raise an event.
End Sub
Sub EventHandler()
' This procedure handles events raised by the object Obj.
MsgBox("EventHandler caught event.") ' Handle the event.
End Sub
Public Class Class1
Public Event Ev_Event() ' Declare an event.
Sub CauseSomeEvent()
RaiseEvent Ev_Event() ' Raise an event.
End Sub
End Class
...should demonstrate how to start and stop eventhandling in your program. But I don't see in what case one can't just substitute the code pasted here with normal function calls.
On the other hand I have this problem. I want to open this form of mine. I have already written code for this, this code is executed by the menuitem miComentary click event.
But I want to execute this same code from another button in my program..can't I force the program to raise the miCommentary_click even somehow? I tried calling it as a normal function, but I have problem figuring out what the valid parameters should be (ByVal sender As System.Object, ByVal e As System.EventArgs)
well, thanks for reading this far
Yours truly
Daed