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.
Why doesn't load event fire when i use form.showialog()?
Collapse
This topic is closed.
X
X
-
EngineerikTags: None -
Jay B. Harlow [MVP - Outlook]
Re: Why doesn't load event fire when i use form.showialog( )?
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 " <Engineerik@dis cussions.micros oft.com> wrote in message
news:543032F0-4C17-4C04-8A1B-F38ECED8ED2F@mi crosoft.com...[color=blue]
> I have a login form which I want to display with the showdialog method.[/color]
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.
-
Engineerik
Re: Why doesn't load event fire when i use form.showialog( )?
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:
[color=blue]
> 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
>[/color]
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.WriteLi ne("frmSplash.s howdialog")
bContinue = frmSplash.ShowD ialog()
'Display without showmodal
Console.WriteLi ne("Now frmsplash.show" )
frmSplash.Show( )
Here is the load event handler of the form:
Private Sub BInitSplash_Loa d(ByVal sender As Object, ByVal e As System.EventArg s) Handles MyBase.Load
Console.WriteLi ne(Me.Name & " load event is firing.")
'Fill in controls as necessary
cbRemember.Chec ked = bRemember
If bRemember Then
tbUserName.Text = sUserName
tbPassword.Text = sPassword
tbDatabaseName. Text = sDatabaseName
tbServerLocatio n.Text = sServerLocation
End If
End Sub
Here is the console output:
[snip]
'BInitPro.exe': Loaded 'c:\windows\ass embly\gac\micro soft.visualbasi c\7.0.3300.0__b 03f5f7f11d50a3a \microsoft.visu albasic.dll', No symbols loaded.
frmSplash.showd ialog
Now frmsplash.show
BInitSplash load event is firing.
'BInitPro.exe': Loaded 'c:\erix\work\b initpro\bin\int erop.scripting. dll', No symbols loaded.
[snip]
Comment
-
Engineerik
Re: Why doesn't load event fire when i use form.showialog( )?
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:
[color=blue]
> 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:
>[color=green]
> > 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
> >[/color]
> 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.WriteLi ne("frmSplash.s howdialog")
> bContinue = frmSplash.ShowD ialog()
>
> 'Display without showmodal
> Console.WriteLi ne("Now frmsplash.show" )
> frmSplash.Show( )
>
> Here is the load event handler of the form:
> Private Sub BInitSplash_Loa d(ByVal sender As Object, ByVal e As System.EventArg s) Handles MyBase.Load
> Console.WriteLi ne(Me.Name & " load event is firing.")
> 'Fill in controls as necessary
> cbRemember.Chec ked = bRemember
>
> If bRemember Then
> tbUserName.Text = sUserName
> tbPassword.Text = sPassword
> tbDatabaseName. Text = sDatabaseName
> tbServerLocatio n.Text = sServerLocation
> End If
>
> End Sub
>
> Here is the console output:
> [snip]
> 'BInitPro.exe': Loaded 'c:\windows\ass embly\gac\micro soft.visualbasi c\7.0.3300.0__b 03f5f7f11d50a3a \microsoft.visu albasic.dll', No symbols loaded.
> frmSplash.showd ialog
> Now frmsplash.show
> BInitSplash load event is firing.
> 'BInitPro.exe': Loaded 'c:\erix\work\b initpro\bin\int erop.scripting. dll', No symbols loaded.
> [snip]
>[/color]
Comment
-
Guest
Re: Why doesn't load event fire when i use form.showialog( )?
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 " <Engineerik@dis cussions.micros oft.com> wrote in message
news:560C41F7-225A-4701-82B7-46DB71D61ADB@mi crosoft.com...[color=blue]
> I just created a new project from scratch that just displays a blank form[/color]
and the load event is firing for both the show and showdialog methods.[color=blue]
> I don't know how I managed to mangle the project I was working on but[/color]
since I wasn't that deep into it I am going to start over with a clean slate
and see what happens.[color=blue]
>
> I will report more on this thread after I recreate the project from[/color]
scratch.[color=blue]
>
> Regards,
> Engineerik
>
> "Engineerik " wrote:
>[color=green]
> > Jay,
> > I have a breakpoint in the load event handler on the line that writes to[/color][/color]
the console. That breakpoint is not encountered if the showdialog method is
used but it is when the show method is used.[color=blue][color=green]
> >
> > You can see from the console output that the write does not occur after[/color][/color]
the showdialog method is used.[color=blue][color=green]
> >
> > I appreciate any suggestions you might have on this.
> >
> > "Jay B. Harlow [MVP - Outlook]" wrote:
> >[color=darkred]
> > > Engineerik,
> > > I use ShowDialog and my Load event fires.
> > >
> > > Can you attach a 15 to 20 line sample program that demostrates the[/color][/color][/color]
problem.[color=blue][color=green][color=darkred]
> > >
> > > Hope this helps
> > > Jay
> > >[/color]
> > 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.WriteLi ne("frmSplash.s howdialog")
> > bContinue = frmSplash.ShowD ialog()
> >
> > 'Display without showmodal
> > Console.WriteLi ne("Now frmsplash.show" )
> > frmSplash.Show( )
> >
> > Here is the load event handler of the form:
> > Private Sub BInitSplash_Loa d(ByVal sender As Object, ByVal e As[/color][/color]
System.EventArg s) Handles MyBase.Load[color=blue][color=green]
> > Console.WriteLi ne(Me.Name & " load event is firing.")
> > 'Fill in controls as necessary
> > cbRemember.Chec ked = bRemember
> >
> > If bRemember Then
> > tbUserName.Text = sUserName
> > tbPassword.Text = sPassword
> > tbDatabaseName. Text = sDatabaseName
> > tbServerLocatio n.Text = sServerLocation
> > End If
> >
> > End Sub
> >
> > Here is the console output:
> > [snip]
> > 'BInitPro.exe': Loaded[/color][/color]
'c:\windows\ass embly\gac\micro soft.visualbasi c\7.0.3300.0__b 03f5f7f11d50a3a \
microsoft.visua lbasic.dll', No symbols loaded.[color=blue][color=green]
> > frmSplash.showd ialog
> > Now frmsplash.show
> > BInitSplash load event is firing.
> > 'BInitPro.exe': Loaded[/color][/color]
'c:\erix\work\b initpro\bin\int erop.scripting. dll', No symbols loaded.[color=blue][color=green]
> > [snip]
> >[/color][/color]
Comment
-
Guest
Re: Why doesn't load event fire when i use form.showialog( )?
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\in terop.scripting .dll', No symbols loaded." Is
that library standard fare? I've seen some strange (similar) "non-errors"
happen with interop.
<cmoyaX@nospam. com> wrote in message
news:efxdmqqUEH A.2944@tk2msftn gp13.phx.gbl...[color=blue]
> 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 " <Engineerik@dis cussions.micros oft.com> wrote in message
> news:560C41F7-225A-4701-82B7-46DB71D61ADB@mi crosoft.com...[color=green]
> > I just created a new project from scratch that just displays a blank[/color][/color]
form[color=blue]
> and the load event is firing for both the show and showdialog methods.[color=green]
> > I don't know how I managed to mangle the project I was working on but[/color]
> since I wasn't that deep into it I am going to start over with a clean[/color]
slate[color=blue]
> and see what happens.[color=green]
> >
> > I will report more on this thread after I recreate the project from[/color]
> scratch.[color=green]
> >
> > Regards,
> > Engineerik
> >
> > "Engineerik " wrote:
> >[color=darkred]
> > > Jay,
> > > I have a breakpoint in the load event handler on the line that writes[/color][/color][/color]
to[color=blue]
> the console. That breakpoint is not encountered if the showdialog method[/color]
is[color=blue]
> used but it is when the show method is used.[color=green][color=darkred]
> > >
> > > You can see from the console output that the write does not occur[/color][/color][/color]
after[color=blue]
> the showdialog method is used.[color=green][color=darkred]
> > >
> > > 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[/color][/color]
> problem.[color=green][color=darkred]
> > > >
> > > > 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.WriteLi ne("frmSplash.s howdialog")
> > > bContinue = frmSplash.ShowD ialog()
> > >
> > > 'Display without showmodal
> > > Console.WriteLi ne("Now frmsplash.show" )
> > > frmSplash.Show( )
> > >
> > > Here is the load event handler of the form:
> > > Private Sub BInitSplash_Loa d(ByVal sender As Object, ByVal e As[/color][/color]
> System.EventArg s) Handles MyBase.Load[color=green][color=darkred]
> > > Console.WriteLi ne(Me.Name & " load event is firing.")
> > > 'Fill in controls as necessary
> > > cbRemember.Chec ked = bRemember
> > >
> > > If bRemember Then
> > > tbUserName.Text = sUserName
> > > tbPassword.Text = sPassword
> > > tbDatabaseName. Text = sDatabaseName
> > > tbServerLocatio n.Text = sServerLocation
> > > End If
> > >
> > > End Sub
> > >
> > > Here is the console output:
> > > [snip]
> > > 'BInitPro.exe': Loaded[/color][/color]
>[/color]
'c:\windows\ass embly\gac\micro soft.visualbasi c\7.0.3300.0__b 03f5f7f11d50a3a \[color=blue]
> microsoft.visua lbasic.dll', No symbols loaded.[color=green][color=darkred]
> > > frmSplash.showd ialog
> > > Now frmsplash.show
> > > BInitSplash load event is firing.
> > > 'BInitPro.exe': Loaded[/color][/color]
> 'c:\erix\work\b initpro\bin\int erop.scripting. dll', No symbols loaded.[color=green][color=darkred]
> > > [snip]
> > >[/color][/color]
>
>[/color]
Comment
Comment