Hello friends :wave:
I'm trying to fire up an event when my object is instantiated right after the form show's event, but it's not working.
Here is what I did:
My form's code..
What am I doing wrong?
I'm trying to fire up an event when my object is instantiated right after the form show's event, but it's not working.
Here is what I did:
Code:
Public Class MyObject
Public Event FileNotFoundEvent(message As String)
Public Sub New()
If Not System.IO.File.Exists("bla") Then
RaiseEvent FileNotFoundEvent("File not found.")
End If
End Sub
End Class
Code:
Private WithEvents TestClass As MyObject
Public Sub OnFileNotFoundEvent(message As String) Handles TestClass.FileNotFoundEvent
MessageBox.Show(message)
End Sub
Private Sub Form1_Shown(sender As Object, e As EventArgs) Handles MyBase.Shown
TestClass = New MyObject()
End Sub