need help with VB
Hello. My problem has to do with Visual Basic 2005 express. I need to know how to make another form come up on the sceen when a button is clicked on.
Thanks to anyone who takes their time to help me out.
Pardon my VB its been a while so my syntax might be off but ill do my best:
So lets say the form that you want to pop up is called frmSecondForm.
'Then you would declare a new object of it.
dim newForm as new frmSecondForm
'Then you call the form to load i think
newForm.load()
'And you may then have to make it visible
newForm.Visible(true)
Again this may be a little off but close enough for you to figure it out. Goodluck to ya. ill check back to see how it goes ^.^d
-sevans
So lets say the form that you want to pop up is called frmSecondForm.
'Then you would declare a new object of it.
dim newForm as new frmSecondForm
'Then you call the form to load i think
newForm.load()
'And you may then have to make it visible
newForm.Visible(true)
Again this may be a little off but close enough for you to figure it out. Goodluck to ya. ill check back to see how it goes ^.^d
-sevans
this didn't work! I did this and it resulted in:
Error 1 'Public Event Load(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
and this:
Error 2 Property access must assign to the property or use its value.
with newForm.load() and newForm.visible(True) underlined.
do you (or any one else) have an idea why this happened?
Maybe i typed .load and .visible in the wrong place?
where should i type them?
Error 1 'Public Event Load(sender As Object, e As System.EventArgs)' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event.
and this:
Error 2 Property access must assign to the property or use its value.
with newForm.load() and newForm.visible(True) underlined.
do you (or any one else) have an idea why this happened?
Maybe i typed .load and .visible in the wrong place?
where should i type them?
I don't believe it's visible you want to use, I think it's show.
So:
So:
Dim newForm As New Form2newForm.Show()
yep, like i said my syntax was probably off. But Form.Visible is not a method, that was my mistake. It is a property, like a data member you just assign it a value, like this:
frmSecondForm.Visible = true;
is your code working now? the load event might not need to be raised.
-sevans
frmSecondForm.Visible = true;
is your code working now? the load event might not need to be raised.
-sevans
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement