468,766 Members | 1,545 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,766 developers. It's quick & easy.

Why doesn't load event fire when i use form.showialog()?

I have a login form which I want to display with the showdialog method. When I do that the event handler for the load event does not run. If I use the show method the load event handler runs perfectly. I can't find any documentation regarding the load event not firing when a form is displayed using the showdialog method.
Nov 20 '05 #1
5 4673
Engineerik,
I use ShowDialog and my Load event fires.

Can you attach a 15 to 20 line sample program that demostrates the problem.

Hope this helps
Jay

"Engineerik" <En********@discussions.microsoft.com> wrote in message
news:54**********************************@microsof t.com...
I have a login form which I want to display with the showdialog method.

When I do that the event handler for the load event does not run. If I use
the show method the load event handler runs perfectly. I can't find any
documentation regarding the load event not firing when a form is displayed
using the showdialog method.
Nov 20 '05 #2
Jay,
I have a breakpoint in the load event handler on the line that writes to the console. That breakpoint is not encountered if the showdialog method is used but it is when the show method is used.

You can see from the console output that the write does not occur after the showdialog method is used.

I appreciate any suggestions you might have on this.

"Jay B. Harlow [MVP - Outlook]" wrote:
Engineerik,
I use ShowDialog and my Load event fires.

Can you attach a 15 to 20 line sample program that demostrates the problem.

Hope this helps
Jay

Here is a code snippet and the console output I got.
The following code is in sub main() which is the startup object
Friend WithEvents frmSplash As New BInitSplash()
Friend WithEvents frmMain As New frmBInitMain()
[snip]
'Display the Splash Form
Console.WriteLine("frmSplash.showdialog")
bContinue = frmSplash.ShowDialog()

'Display without showmodal
Console.WriteLine("Now frmsplash.show")
frmSplash.Show()

Here is the load event handler of the form:
Private Sub BInitSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Console.WriteLine(Me.Name & " load event is firing.")
'Fill in controls as necessary
cbRemember.Checked = bRemember

If bRemember Then
tbUserName.Text = sUserName
tbPassword.Text = sPassword
tbDatabaseName.Text = sDatabaseName
tbServerLocation.Text = sServerLocation
End If

End Sub

Here is the console output:
[snip]
'BInitPro.exe': Loaded 'c:\windows\assembly\gac\microsoft.visualbasic\7.0 .3300.0__b03f5f7f11d50a3a\microsoft.visualbasic.dl l', No symbols loaded.
frmSplash.showdialog
Now frmsplash.show
BInitSplash load event is firing.
'BInitPro.exe': Loaded 'c:\erix\work\binitpro\bin\interop.scripting.dll', No symbols loaded.
[snip]

Nov 20 '05 #3
I just created a new project from scratch that just displays a blank form and the load event is firing for both the show and showdialog methods.
I don't know how I managed to mangle the project I was working on but since I wasn't that deep into it I am going to start over with a clean slate and see what happens.

I will report more on this thread after I recreate the project from scratch.

Regards,
Engineerik

"Engineerik" wrote:
Jay,
I have a breakpoint in the load event handler on the line that writes to the console. That breakpoint is not encountered if the showdialog method is used but it is when the show method is used.

You can see from the console output that the write does not occur after the showdialog method is used.

I appreciate any suggestions you might have on this.

"Jay B. Harlow [MVP - Outlook]" wrote:
Engineerik,
I use ShowDialog and my Load event fires.

Can you attach a 15 to 20 line sample program that demostrates the problem.

Hope this helps
Jay

Here is a code snippet and the console output I got.
The following code is in sub main() which is the startup object
Friend WithEvents frmSplash As New BInitSplash()
Friend WithEvents frmMain As New frmBInitMain()
[snip]
'Display the Splash Form
Console.WriteLine("frmSplash.showdialog")
bContinue = frmSplash.ShowDialog()

'Display without showmodal
Console.WriteLine("Now frmsplash.show")
frmSplash.Show()

Here is the load event handler of the form:
Private Sub BInitSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
Console.WriteLine(Me.Name & " load event is firing.")
'Fill in controls as necessary
cbRemember.Checked = bRemember

If bRemember Then
tbUserName.Text = sUserName
tbPassword.Text = sPassword
tbDatabaseName.Text = sDatabaseName
tbServerLocation.Text = sServerLocation
End If

End Sub

Here is the console output:
[snip]
'BInitPro.exe': Loaded 'c:\windows\assembly\gac\microsoft.visualbasic\7.0 .3300.0__b03f5f7f11d50a3a\microsoft.visualbasic.dl l', No symbols loaded.
frmSplash.showdialog
Now frmsplash.show
BInitSplash load event is firing.
'BInitPro.exe': Loaded 'c:\erix\work\binitpro\bin\interop.scripting.dll', No symbols loaded.
[snip]

Nov 20 '05 #4
It sounds like your "Form_Load" proc in your code lost its "Handles
MyBase.Load" directive at the end. They're easy to miss.

"Engineerik" <En********@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
I just created a new project from scratch that just displays a blank form and the load event is firing for both the show and showdialog methods. I don't know how I managed to mangle the project I was working on but since I wasn't that deep into it I am going to start over with a clean slate
and see what happens.
I will report more on this thread after I recreate the project from scratch.
Regards,
Engineerik

"Engineerik" wrote:
Jay,
I have a breakpoint in the load event handler on the line that writes to the console. That breakpoint is not encountered if the showdialog method is
used but it is when the show method is used.
You can see from the console output that the write does not occur after the showdialog method is used.
I appreciate any suggestions you might have on this.

"Jay B. Harlow [MVP - Outlook]" wrote:
Engineerik,
I use ShowDialog and my Load event fires.

Can you attach a 15 to 20 line sample program that demostrates the problem.
Hope this helps
Jay

Here is a code snippet and the console output I got.
The following code is in sub main() which is the startup object
Friend WithEvents frmSplash As New BInitSplash()
Friend WithEvents frmMain As New frmBInitMain()
[snip]
'Display the Splash Form
Console.WriteLine("frmSplash.showdialog")
bContinue = frmSplash.ShowDialog()

'Display without showmodal
Console.WriteLine("Now frmsplash.show")
frmSplash.Show()

Here is the load event handler of the form:
Private Sub BInitSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Console.WriteLine(Me.Name & " load event is firing.")
'Fill in controls as necessary
cbRemember.Checked = bRemember

If bRemember Then
tbUserName.Text = sUserName
tbPassword.Text = sPassword
tbDatabaseName.Text = sDatabaseName
tbServerLocation.Text = sServerLocation
End If

End Sub

Here is the console output:
[snip]
'BInitPro.exe': Loaded 'c:\windows\assembly\gac\microsoft.visualbasic\7.0 .3300.0__b03f5f7f11d50a3a\
microsoft.visualbasic.dll', No symbols loaded. frmSplash.showdialog
Now frmsplash.show
BInitSplash load event is firing.
'BInitPro.exe': Loaded 'c:\erix\work\binitpro\bin\interop.scripting.dll', No symbols loaded. [snip]

Nov 20 '05 #5
After reading one of your latter posts, I see that's not your problem. Sorry
for that.
Though I'm curious about the
"'c:\erix\work\binitpro\bin\interop.scripting.dll' , No symbols loaded." Is
that library standard fare? I've seen some strange (similar) "non-errors"
happen with interop.

<cm****@nospam.com> wrote in message
news:ef**************@tk2msftngp13.phx.gbl...
It sounds like your "Form_Load" proc in your code lost its "Handles
MyBase.Load" directive at the end. They're easy to miss.

"Engineerik" <En********@discussions.microsoft.com> wrote in message
news:56**********************************@microsof t.com...
I just created a new project from scratch that just displays a blank form
and the load event is firing for both the show and showdialog methods.
I don't know how I managed to mangle the project I was working on but since I wasn't that deep into it I am going to start over with a clean

slate and see what happens.

I will report more on this thread after I recreate the project from scratch.

Regards,
Engineerik

"Engineerik" wrote:
Jay,
I have a breakpoint in the load event handler on the line that writes

to the console. That breakpoint is not encountered if the showdialog method is used but it is when the show method is used.
You can see from the console output that the write does not occur
after
the showdialog method is used.
I appreciate any suggestions you might have on this.

"Jay B. Harlow [MVP - Outlook]" wrote:

> Engineerik,
> I use ShowDialog and my Load event fires.
>
> Can you attach a 15 to 20 line sample program that demostrates the problem. >
> Hope this helps
> Jay
>
Here is a code snippet and the console output I got.
The following code is in sub main() which is the startup object
Friend WithEvents frmSplash As New BInitSplash()
Friend WithEvents frmMain As New frmBInitMain()
[snip]
'Display the Splash Form
Console.WriteLine("frmSplash.showdialog")
bContinue = frmSplash.ShowDialog()

'Display without showmodal
Console.WriteLine("Now frmsplash.show")
frmSplash.Show()

Here is the load event handler of the form:
Private Sub BInitSplash_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Console.WriteLine(Me.Name & " load event is firing.")
'Fill in controls as necessary
cbRemember.Checked = bRemember

If bRemember Then
tbUserName.Text = sUserName
tbPassword.Text = sPassword
tbDatabaseName.Text = sDatabaseName
tbServerLocation.Text = sServerLocation
End If

End Sub

Here is the console output:
[snip]
'BInitPro.exe': Loaded 'c:\windows\assembly\gac\microsoft.visualbasic\7.0 .3300.0__b03f5f7f11d50a3a\ microsoft.visualbasic.dll', No symbols loaded. frmSplash.showdialog
Now frmsplash.show
BInitSplash load event is firing.
'BInitPro.exe': Loaded 'c:\erix\work\binitpro\bin\interop.scripting.dll', No symbols loaded. [snip]


Nov 20 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Shimon Sim | last post: by
4 posts views Thread by Rob Richardson | last post: by
3 posts views Thread by Dennis | last post: by
2 posts views Thread by John Kotuby | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.