Sign in to follow this  
annoyer101

need help with VB

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
I don't believe it's visible you want to use, I think it's show.

So:
Dim newForm As New Form2
newForm.Show()


Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this