I just can't, im guessing something's not enabled, but what?
Go to your "My Project" node in your solutions tree. Click on this button:
It should result in the following file:
Namespace My
' The following events are available for MyApplication:
'
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
Partial Friend Class MyApplication
End Class
End Namespace
Once there, you should have the (MyApplication Events) in the left ComboBox in your code editor, and the list of events in the right ComboBox.
Note: You might have to delete the empty file you already have before creating this.
I think the problem here is that you simply created a .vb file without relating it to something that actually has events. Based on the picture, I'm thinking you want to handle the events in your frmInvoice.vb in the ApplicationEvents.vb. If this is the intent, then you should preface the class definition in the frmInvoice file with Partial and create an identically named class in the ApplicationEvents.vb (also prefaced with partial). The partial keyword allows you to span classes across files. The implementation looks like this:
'On actual form
Partial Public Class Form1
End Class
'On other .vb file
Partial Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("test")
End Sub
End Class
I personally don't care for this approach and prefer using regions within a single file.
#region "Events"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With