I have a form containing a ListBox which allows a user to select a new value, click save, and return to the main form. It is called using a public method which has a this.ShowDialog() call. The ListBox is populated on the form’s Load event, and the problem I am having is that when I attempt to set the current value it is unable to do so as the ListBox hasn’t been populated at that point. It is populated by the time the form appears on the screen.
In VBA I could always rely on the UserForm_Initialize event having been fired by the time I did any interaction with the form, so my question is how do I achieve the same result in C#? Do I need to have a public method which populates my form and have to remember to call that each time I use the form?
Thanks
You can initialise the list box in the constructor of the form