Jump to content


Photo
- - - - -

[VB] - [Properties VIA Code] - [ronson]


  • Please log in to reply
10 replies to this topic

#1 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 27 October 2004 - 04:44 PM

Properties via Code

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:

Posted Image

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

Posted Image

Posted Image

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 Faken

Faken

    Pimpmaster G

  • Admin
  • 5,966 posts
  • Gender:Male
  • Location:Montreal, Canada

Posted 23 February 2005 - 10:40 PM

Ronson - Please email me the images so I can host them for you. ;)

Faken

#3 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 06 March 2005 - 06:21 PM

ATM faken, i haven't got the images, but when i find some time, i'll create some new ones and email them to you.

#4 Donna

Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 25 March 2005 - 08:31 PM

Did the images ever come for this tut?

#5 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 03 May 2005 - 12:26 PM

Did the images ever come for this tut?

Yeh, long before you was here, thanks for the sarcasm.

#6 Donna

Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 03 May 2005 - 12:30 PM

Did the images ever come for this tut?

Yeh, long before you was here, thanks for the sarcasm.

Its not sarcasm we were removing all the dead tutorials form Pixel2Life

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 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 03 May 2005 - 12:37 PM

If you must know, i do have other things to do other than make images for tutorials, i have course work and exams for college. And since i've got free time i've just found the images for BOTH of my tutorials.

#8 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 03 May 2005 - 12:38 PM

and I joined here 4dys after you if you notice.

I think you'll find i was on this forum before the date registered, i was here before the forum was hacked.

#9 Donna

Donna

    Retired P2L Queen!

  • P2L Staff
  • PipPipPipPip
  • 12,330 posts
  • Gender:Female
  • Location:B.C Canada

Posted 03 May 2005 - 12:49 PM

and I joined here 4dys after you if you notice.

I think you'll find i was on this forum before the date registered, i was here before the forum was hacked.

Doesn't matter when you or I was here, we just need images in the tut

After you have read this I'll remove all the silly replies.

#10 Faken

Faken

    Pimpmaster G

  • Admin
  • 5,966 posts
  • Gender:Male
  • Location:Montreal, Canada

Posted 03 May 2005 - 01:09 PM

Ok guys chill.... Ronson - Donna is just doing her job so stop giving her a hard time. Let's all just get along because this bickering is completely pointless. She was asking a sincere question and not being sarcastic so stop attacking her.

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 ronson

ronson

    Banned For Being Purple

  • Twodded Staff
  • PipPip
  • 480 posts
  • Gender:Male
  • Location:North Yorkshire, UK
  • Interests:Rugby, Programming, Building Computers, Networking, Web Design and...........BINGE DRINKING!!!!!!.

Posted 03 May 2005 - 02:57 PM

Yes those images were for my tutorials, i have written and posted.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users