A few things you may not have known

Submitted on: 1/28/2015 12:10:00 AM
By: john sheridan (from psc cd)  
Level: Beginner
User Rating: By 6 Users
Compatibility: VB 6.0
Views: 323
     Just a few things about vb that will probably be helpful to you once in a while.

				Did you know you can set boolean variables to mathematical equations? For example: 

Dim blnMyBoolean As Boolean

blnMyBoolean = (1 + 1 = 2)

This would assign the variable a True value. On the other hand, this...

blnMyBoolean = (1 + 1 = 3)

...would give the variable a False value.
You can also use greater than or less than:

blnMyBoolean = (1 < 2) 'true

This is useful if you're making a math quiz program or something or you use boolean variables that test numbers.

Another good tip I know that saves time is a quick way to reverse boolean variables. For example, say you have a Command Button that Enables or Disables a timer. Instead of using an if, just do this:

Private Sub Command1_Click()
Timer1.Enabled = Not Timer1.Enabled
End Sub

You can also use this with Visible, or any other boolean variable.

I hope these two quick tips helped you. No need to vote, I just felt like uploading this.

Other 3 submission(s) by this author


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.