Tuesday, April 14, 2009

Sorry.. busy lately..

hmm..., lately busy with visual basic.
Thanx to my teacher la...
Made my life harder...

Anywayz, as i had mention that you have to master the properties before you do the coding.

Well, If..then..end if was quite useful though

Example:

If Combo1.text = "Okay" Then
Label1.caption = "Thank you"
End if

The code means that in combobox1, if i choose "Okay", then "Thank you" will appear at label1.
I had to use caption for label and not text instead coz i am using visual basic 6.0.
That ict teacher of mine insist on using that ancient program.
I would prefer visual basic express though.

There is another method instead of using if..then..end if
We can also use case:

Example:

Select case Combo1.text
Case "Okay" : Label.caption = "Thank you"
Case "Not okay" : Label.caption = "whats wrong with you?"
End select


In case, we use less space and more tidy.

No comments: