954,558 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Code examples for events (e.g. buttons) for a newbie

Hi

I am a new user of VB (or any prgramming for that matter) and keen to learn. A very simple example of what I was looking for was the code for a button to open another form. Does anyone know where I can access simple event proceedure codes - a sort of list of basics if you like. Any help would be appreciated.

Regards

Bernard

Bernard Kane
Newbie Poster
8 posts since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

Hmn, as far as I know, The closest thing you'll get is the MSDN library, and good luck making a lot of sense of it.... a Visual Basic 6 example of this, assuming you have 2 forms, form1 and form2, would look like this in the command button:

form2.visible = true
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Hmn, as far as I know, The closest thing you'll get is the MSDN library, and good luck making a lot of sense of it.... a Visual Basic 6 example of this, assuming you have 2 forms, form1 and form2, would look like this in the command button:

form2.visible = true



Many thanks but I have tried this without much luck. I agree that the MSDN Library is much for someone called Einstein than a humble beginner like me.

Thanks for your input anyway.

Regards

Bernard:sad:

Bernard Kane
Newbie Poster
8 posts since Jul 2006
Reputation Points: 10
Solved Threads: 0
 

Is this in vb6, or .NET? If it's in VB4, 5, or 6, post the project in a .zip and I'll check it out.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

You can use the show and hide
if you have tow forms form1 in which your command button is placed and form2 the one you want to go to when you click the button you can easily write in the click event of the command button

Private Sub Command2_Click()
form1.hide
form2.show
End Sub
lover99509
Newbie Poster
21 posts since Jul 2006
Reputation Points: 15
Solved Threads: 1
 

You can use the show and hide if you have tow forms form1 in which your command button is placed and form2 the one you want to go to when you click the button you can easily write in the click event of the command button

Private Sub Command2_Click()
form1.hide
form2.show
End Sub

Nice Post lover99509, but it should be also noted that using the .hide and the .show method is significantly slower on benchmark tests than directly altering the .Visible property itself....

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You