Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am working on a small project that uses multiple forms to display contents of multiple tables within a database.

 

My problem is that when I click FILE > NEW > different form....

I can create a new instance of my other forms that are fully functionable but my previous form stays in the background.

 

How do I close the form from my menu button? I tried calling my mmuFileExit() button but that doesn't work.

 

All help would be greatly appreciated.

Thanks. :)

Posted

I've tried that but my original forms are still visible in the background.

 

This is my code for my mmuNewCourse:

 

 

Private Sub mmuNewCourse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mmuNewCourse.Click

 

Dim frmCourse As New frmCourse

frmCourse.ShowDialog()

 

Call mmuFileExit(ByVal sender As System.Object, ByVal e As System.EventArgs)

 

End Sub

 

 

I tried calling my exit button but when I tried I came up with more errors. I want the new form to open and the old form to close.

 

Thanks.

Posted
If the forms are declared public then you can in the New of the second form hide the visible one, I use that and it works ....
Dream as if you'll live forever, live as if you'll die today
Posted

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
       Dim SecondForm As New Form2 'new instance of second form
       Me.Hide() 'hides first form
       SecondForm.Show()
End Sub

 

Not sure why your trying to call your exit routine, but this is how you should use Me.Hide.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...