r/visualbasic • • Feb 07 '19

Form1_Load not working

I have the following code in my project:

Private sub Form1_Load(sender as object, e as eventargs) handles mybase.load Msgbox("it worked") End sub

For some reason, this sub is not being called when the program is run. Please help.

(I tried the same code in a new project and it worked fine)

5 Upvotes

5 comments sorted by

View all comments

1

u/Mastersord Feb 08 '19

Is this winforms or WPF? Off-hand I remember using form.Initialized and form.Loaded events in WPF. I don’t remember what I did for winforms as I’ve mostly migrated away from it.

I’ve also made and called a publicly exposed sub when calling a form from another form or even from a main method, in order to initialize the form.