I'm working with the following bit of code to invoke a dialog.
Using frmSomeForm As New SomeForm()
frmSomeForm.intSomeVariable = 6
Private Sub SomeForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If intSomeVariable <> 0 Then SomeOtherSub()
Load event is only raised once you call
ShowDialog(), when the form is about to be shown. Currently your
frmSomeForm.intSomeVariable = 6 line will always fire before the
Answering your comment
"Would a Property also work in this case?":
Keep in mind that any code that you put before your
ShowDialog() call will be executed first, even if it's a time consuming one. Code isn't executed asynchronously line-by-line.
For example, this:
would only call
frmSomeForm.ShowDialog() after the
TimeConsumingMethod() has completed successfully, even if that takes for ever.