Alternating the X on a form.

ApocalypsXV
05-28-2004, 04:23 PM
Hi i am wondering where i can alternate the X i got some what of a problem

I have mange to get Form1 to show a Form2 and automaticly closing Form1
leaving only Form2 its all good still but here comes the catch i try to close Form2 by means of the X it will close but the program is still running or at least its not going back in design mode.

Question is if i dont fix it will it cause a memory leak or anything?

and if yes how do i change the code of X or make it it will close the enire project. instead of just that one form???

Iceplug
05-28-2004, 07:05 PM
Let me see how you are loading the form (the whole subroutine please). You probably need to remember to Close the original form. :)

ApocalypsXV
05-28-2004, 07:40 PM
OK here is the code from my Form1 Button

Private Sub NewAccount_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewAccount.Click
closeapp = False
Dim oForm As Create_New
oForm = New Create_New
oForm.Show()
Me.Close()
End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If closeApp Then
Application.Exit()
End If
End Sub

Abd this is from my form 2 loading form 3

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim oForm As Create_New2
oForm = New Create_New2
oForm.Show()
Me.Close()
End Sub

And this here i got since i need it to have Form1 close while having from2 running witouth quiting the program

Module Module1
Sub main()
Dim frmMain As New Form1
frmMain.Show()
Application.Run() '/// NOTE : i run the application without a start-up Main form.
End Sub
End Module

But basicly i run debug and once i press the X on Form2 or 3 the program goes away but it still since the debug mode is still on.

Also i am sorry if i dint paste my code correct i dont know how to get like the others in color and style if osmone tells me how i will do it :)

Iceplug
05-28-2004, 07:44 PM
Would it work if you change all of those oForm.Show statements into oForm.ShowDialog statements?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum