
- VBForums
- Visual Basic
- Visual Basic 6 and Earlier
- Opening new forms.,,.,,.,,.,,.,,.,,
-
Aug 3rd, 2000, 03:14 PM
#1
Thread Starter
Member
From withtin a form, how do you open a new form with the click of a button, please help....
Wisdom is supreme, therefore get wisdom,
though it costs all you have, get understanding.
Proverbs 4:7
-
Aug 3rd, 2000, 03:22 PM
#2
_______
<?>
assuming the form is created
Load frmYourForm
frmYourForm.Show
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 3rd, 2000, 03:26 PM
#3
Thread Starter
Member
Well,, hmmmm
Well, ok asume that the first form is called menu.frm and the second form is called menu2.frm, where would I put that code and how would the code go, (for loading when a button was clicked)
Wisdom is supreme, therefore get wisdom,
though it costs all you have, get understanding.
Proverbs 4:7
-
Aug 3rd, 2000, 03:33 PM
#4
_______
<?>
Code:
weird naming convention? However...
'any click event of any control on form menu.frm
unload menu.frm
load menu2.frm
menu2.show
'on form menu2.frm you would revers the order
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 3rd, 2000, 03:33 PM
#5
Hyperactive Member
Code:
'Command1, I am assuming is the name of your button
Private sub Command1_Click()
menu2.Show
'If you want to hide the first form, just use
'menu1.hide
'otherwise the menu2 form with be shown ontop of the first
End sub
-
Aug 3rd, 2000, 03:36 PM
#6
It's a good idea to use Unload when you want to get rid of the Form.
-
Aug 3rd, 2000, 03:40 PM
#7
Thread Starter
Member
Ok, one more time
Well, this is my code:
Private Sub Command10_Click()
Unload menu1.frm
Load menu2.frm
menu2.Show
End Sub
and this is the return code:
Unload menu2.frm
Load menu1.frm
menu1.Show
Now what did I do?! I get an error saying An object is required. Help?
Wisdom is supreme, therefore get wisdom,
though it costs all you have, get understanding.
Proverbs 4:7
-
Aug 3rd, 2000, 03:44 PM
#8
Hyperactive Member
it should look like:
Code:
Private Sub Command10_Click()
Unload menu1
Load menu2
menu2.Show
End Sub
Leave off the .frm
-
Aug 3rd, 2000, 03:45 PM
#9
_______
'take the . out of your names
call it frmMenu2 and frmMenu
Private Sub Command10_Click()
Unload frmMenu
Load frmMenu2
frmMenu2.Show
End Sub
and this is the return code:
Unload frmMenu2
Load frmMenu1
frmMenu1.Show
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 3rd, 2000, 03:56 PM
#10
You could also set frmmenu2 to nothing, which would clear up any resources still running.
Code:
Unload frmMenu2
Set frmMenu2 = Nothing
Load frmMenu1
frmMenu1.Show
-
Aug 3rd, 2000, 04:51 PM
#11
You don't even have to use Load frmMenu2 if it isn't loaded then frmMenu2.show will load it.
-
Aug 3rd, 2000, 06:41 PM
#12
You probably are a bit confused over the Load and Show events
Load
frmMenu2.Load, stores the form in memory and executes the Load event of the form. It doesn't show on your desktop, but is waiting rearing to go.
Show
frmMenu2.Show, if not loaded previous executes the Load event and displays the form on your screen.
Hide
frmMenu2.Hide, the form is still in memory but is not displayed. generally used if you are going to re-display the form but want to keep it in memory.
Hope that it clear.
-
Aug 4th, 2000, 08:35 AM
#13
Then you can use Unload to destory the Form and release it from memory.
Code:
Unload Form1
Set Form1 = Nothing

- VBForums
- Visual Basic
- Visual Basic 6 and Earlier
- Opening new forms.,,.,,.,,.,,.,,.,,
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
|