|
-
January 22nd, 2000, 01:11 AM
#1
Links
Hi,
I have Two Command Buttons on my form . One is an Update Button which updates an access database and the other is an Exit button which leads me to the Menu.
How do i direct the exit button to lead me to the menu.
What's the code???
Just like in html you have your links <a href="whatever.html">. How do i do this in Visual Basic?
Thanks alot,
Derek
-
January 24th, 2000, 02:48 PM
#2
Re: Links
There are a couple of ways to do this.
1) I assume that when you say "the menu" you mean the main form in the application that maybe has some buttons on it that open up other forms and such. If this is true, lets call that form frmMain. Then in your exit button's code place this code:
Private Sub cmdExit_Click()
Unload Me
frmMain.Show
End Sub
This will unload the current form and bring up the main form from which you can choose a different option.
2) If by the "the menu" you mean a form that is always visible in the background and has the menu items as actual menus (like the background form in VB with the Project, File, Tools menus etc.) then in your Exit button's code you would have:
Private Sub cmdExit_Click()
Unload Me
End Sub
The reason I don't have to call the .Show method of the main form is because it is already visible and the Update form is in front of the main form. You might see other posts about this sort of thing wehre this main form is called an MDI (Multiple Document Interface) form. These are usually used when there are quite a few forms that are used in the application.
I'm sure there are more ways to do this than what I have shown here, but this should get you started.
In general when you have a "child" form (the update form) that you access from the "parent" form (the menu form, or mdi form), to get back to the parent form you'll just unload the child and show the parent. In an MDI application, the parent form is always showing, so you don't have to tell it to show.
I hope this helps and I didn't confuse you,
John
John Pirkey
MCSD
www.ShallowWaterSystems.com
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
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
|