FuneralofSmiles Posted December 7, 2003 Posted December 7, 2003 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. :) Quote
Leaders dynamic_sysop Posted December 7, 2003 Leaders Posted December 7, 2003 to hide your existing form ... Me.Hide() '/// or MyBase.Hide() Quote
FuneralofSmiles Posted December 7, 2003 Author Posted December 7, 2003 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. Quote
Mehyar Posted December 8, 2003 Posted December 8, 2003 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 .... Quote Dream as if you'll live forever, live as if you'll die today
JospehW Posted December 9, 2003 Posted December 9, 2003 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.