|
-
May 23rd, 2005, 01:16 PM
#1
Thread Starter
Addicted Member
Loading form ¿? (RESOLVED)
Hi i have 2 forms "form1" and "MdiPrincipal"
In form1 i have a button when the user do a click the form1 must close and show the mdi
Code:
VB Code:
Private Sub CmdAceptar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdAceptar.Click
Dim Mdi As New MdiPrincipal
Mdi.Show()
'Mdi.Dispose()
Me.close()
but when i click the button it opens the mdi and then automatically closes
if i use it opens the Mdi but the form1 is already open
if i use the form1 is invisible but is in memory...
I want to close the form1 and open the Mdi
Last edited by Sanko; May 23rd, 2005 at 06:17 PM.
-
May 23rd, 2005, 01:49 PM
#2
Re: Loading form ¿?
You may want to use a Module Sub Main procedure as your startup object. Then in there you can run your
form1 with .ShowDialog. When it gets disposed the next line of code in the sub main will execute. This would be your
mdiprincipal.showdialog.
VB Code:
Option Explicit On
Module Module1
Public Sub Main()
Application.Run(New Form1)
Application.Run(New MdiPrincipal)
End Sub
End Module
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 23rd, 2005, 03:26 PM
#3
Re: Loading form ¿?
I generally have a construct where there is a perpetual loop in Sub Main. The loop calls a sub which holds a Select statement. For each case, I show a separate form. It looks something like this in Main:
VB Code:
theState=1
do while thestate>0
Ladder
loop
Sub Ladder looks something like this:
[Highlight=VB]
Sub Ladder()
select case theState
case 1
form1.showdialog
case 2
form2.showdialog
end select
end sub
This means that each form only has to set the theState variable to the next form that should be shown, then it can close. Of course, in this example, the forms are all global instances, but you certainly could make them local to the select case.
My usual boring signature: Nothing
 
-
May 23rd, 2005, 05:29 PM
#4
Thread Starter
Addicted Member
Re: Loading form ¿?
Ok but i have a splash screen wich opens form1 and then i must open the MDI; the estructure looks like
Show splash screen (validations, DB, etc) --> then closes the splash screen and opens ("form1") wich is a Login form if the user is acepted he must click a button which closes the login form and --> open the MDI
Splash --> User Login --> MDI
Last edited by Sanko; May 23rd, 2005 at 05:32 PM.
-
May 23rd, 2005, 05:39 PM
#5
Re: Loading form ¿?
Since your splash form has the validation code in it you can probably organize it like so...
VB Code:
Option Explicit On
Module Module1
Public Sub Main()
Application.Run(New frmSplash)
Application.Run(New Form1)
Application.Run(New MdiPrincipal)
End Sub
End Module
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 23rd, 2005, 06:16 PM
#6
Thread Starter
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|