[VB] - [Properties VIA Code] - [ronson]
#1
Posted 27 October 2004 - 04:44 PM
Open up Visual Basic and click on Standard Exe once you’re form has loaded put 2 Command buttons on your form and a text box and give them the names “cmdGood” and “cmdBad” it doesn’t matter which one has what BUT don’t give you’re buttons a caption leave them as they are and give the text box the name txtMsg.
Double click on “cmdGood” button and insert in this code:
Private Sub cmdGood_click()
Form1.Caption = "Visual Basic is Good"
txtMsg.Text = "Visual Basic Rules!"
End Sub
After that double click on cmdBad button and insert this code:
Private Sub cmdBad_click()
Form1.Caption = "Visual Basic is Bad"
txtMsg.Text = "Visual Basic Sucks!"
End Sub
Then after that click on the form its self and insert this code:
Private Sub Form_Load()
Form1.Caption = "Visual Basic Is..."
cmdGood.Caption = "Good"
cmdBad.Caption = "Bad"
txtMsg.Text = ""
End Sub
When you have entered the code it shoud look like this:
Explanation of the code.
cmdGood and cmdBad
Form1.caption – This changes the text at the top of the forms title bar from form1 to Visual Basic is good/bad
txtMsg.text – This puts text in the text box.
Form_Load
Any code put into the form load event will be executed when the program is started, this is where you would put you're spash scren code.
Form1.caption – This changes the text at the top of the forms title bar from form1 to Visual Basic is…
cmdGood.Caption – This gives the command buttons its Caption it changes it from Command 1 to Good the same goes for cmdBad
txtMsg.Text = “” – this is the same as above BUT since there is no text in between the speech marks it just makes the text box empty.
Click Run > Start and click the buttons and watch what happens
Well there you go! There is you’re second program. Click File > Make project1.exe to make it a .exe, for you’re homework, I suggest you play about with the Properties VIA code.
If you have any questions just post them. Hope you liked my tutorial!
RoNsOn
#2
Posted 23 February 2005 - 10:40 PM
Faken
#3
Posted 06 March 2005 - 06:21 PM
#4
Posted 25 March 2005 - 08:31 PM
#5
Posted 03 May 2005 - 12:26 PM
Yeh, long before you was here, thanks for the sarcasm.Did the images ever come for this tut?
#6
Posted 03 May 2005 - 12:30 PM
Its not sarcasm we were removing all the dead tutorials form Pixel2LifeYeh, long before you was here, thanks for the sarcasm.Did the images ever come for this tut?
and still this has no images, its of no use to anyone without them.
and I joined here 4dys after you if you notice.
#7
Posted 03 May 2005 - 12:37 PM
#8
Posted 03 May 2005 - 12:38 PM
I think you'll find i was on this forum before the date registered, i was here before the forum was hacked.and I joined here 4dys after you if you notice.
#9
Posted 03 May 2005 - 12:49 PM
Doesn't matter when you or I was here, we just need images in the tutI think you'll find i was on this forum before the date registered, i was here before the forum was hacked.and I joined here 4dys after you if you notice.
After you have read this I'll remove all the silly replies.
#10
Posted 03 May 2005 - 01:09 PM
Now then, are these the images you emailed me or is that for a separate tut that is in the word doc?
I'm leaving for a flight in 10 mins and hopefully this crap is gone when I check the messages tonight.
Faken
#11
Posted 03 May 2005 - 02:57 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users