944,165 Members | Top Members by Rank

Ad:
Jul 10th, 2006
0

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

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Bernard Kane is offline Offline
8 posts
since Jul 2006
Jul 10th, 2006
0

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

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:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. form2.visible = true
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Jul 10th, 2006
0

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

Quote originally posted by Comatose ...
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:
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. 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
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Bernard Kane is offline Offline
8 posts
since Jul 2006
Jul 10th, 2006
0

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

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.
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Jul 31st, 2006
1

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

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

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command2_Click()
  2. form1.hide
  3. form2.show
  4. End Sub
Last edited by Comatose; Jul 31st, 2006 at 12:01 pm.
Reputation Points: 15
Solved Threads: 1
Newbie Poster
lover99509 is offline Offline
21 posts
since Jul 2006
Jul 31st, 2006
0

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

Quote originally posted by lover99509 ...
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

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Command2_Click()
  2. form1.hide
  3. form2.show
  4. 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....
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to pass a form to another form
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Check if time is equal = a certain time





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC