I’m doing a Windows Forms project in VB.NET, but VB.NET is completely new to me, I’m primarily a C# developer.
In C# Windows Forms, a user control’s InitializeComponent is called from the form’s/control’s constructor. When I create same scenario in VB.NET I don’t get a constructor, and I can’t locate a place where InitializeComponent is called.
I need to call my code between InitializeComponent and when the control’s Load event is raised, preferably still in the control’s constructor. How do I do this in VB.NET?
Go to View Code in your form, and from the right drop down and select “New Method”.
There you can see where InitializeComponent is called and insert your logic.
Your code, if your form is empty, should look like this: