|
-
Dec 18th, 2003, 01:17 PM
#1
Thread Starter
Addicted Member
Closing Form**Resolved**
Hi, I have it so a form loads from the sub main and after the user presses a button i want it to load a another form and close the current on. I can load it fine but i tried everything and cant close the current form. I dont want to hide it either. Thanks
And is there a way to disable that JIT debugger from coming up?
Last edited by VBGangsta; Dec 18th, 2003 at 05:13 PM.
-Rob
-
Dec 18th, 2003, 04:18 PM
#2
Frenzied Member
You could do this:
VB Code:
Public Sub main()
Dim frm1 As New Form1
Dim frm2 As New Form2
frm1.ShowDialog()
frm2.ShowDialog()
End Sub
and on the Form1 button click call Me.Close()
-
Dec 18th, 2003, 04:23 PM
#3
Thread Starter
Addicted Member
i tried to Me.Close() after the second form was loaded and it didnt work.
-
Dec 18th, 2003, 04:25 PM
#4
Frenzied Member
make sure the Startup Object is set to Sub Main...
and you have to make your Sub Main is just like mine and call ShowDialog() not just Show() or it won't work.
-
Dec 18th, 2003, 04:32 PM
#5
Thread Starter
Addicted Member
On submain...
VB Code:
Module mMain
Public Sub Main()
If frmRegister.IsRegistered Then
Dim frm As New Form4
frm.ShowDialog()
''(what i had)'Application.Run(New Form4)
End If
Application.Exit()
End If
End Sub
End Module
On form4
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Close()
Dim frm As New Form1
frm.ShowDialog()
End Sub
I still have the same problem, am i doing something wrong?
-
Dec 18th, 2003, 04:35 PM
#6
Addicted Member
I have that exact same problem and also cant get it to work.
-
Dec 18th, 2003, 04:40 PM
#7
Try this:
VB Code:
Module mMain
Public Sub Main()
If frmRegister.IsRegistered Then
Dim frm As New Form4
frm.ShowDialog()
Dim frm1 As New Form1
frm1.ShowDialog()
End If
'Application.Exit() not needed
End Sub
End Module
-
Dec 18th, 2003, 04:42 PM
#8
Frenzied Member
The second form shows when the first form is closed too.
I think he only wants the second form to show if the button is clicked.
-
Dec 18th, 2003, 04:46 PM
#9
Thread Starter
Addicted Member
Yeah, i want form1 to open only after a button on form4 is pressed.
-
Dec 18th, 2003, 04:53 PM
#10
Frenzied Member
VB Code:
Module mMain
Public Sub Main()
If frmRegister.IsRegistered Then
Dim frm As New Form4
frm.ShowDialog()
End If
End Sub
On form4
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm As New Form1
Me.Hide()
Me.Close()
frm.ShowDialog()
End Sub
-
Dec 18th, 2003, 05:00 PM
#11
Thread Starter
Addicted Member
Excellent!!!! Thank you Much
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
|