Search Tools Links Login

A few things you may not have known


Visual Basic 6, or VB Classic

Just a few things about vb that will probably be helpful to you once in a while.

Original Author: john sheridan

Code

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.


About this post

Posted: 2003-06-01
By: ArchiveBot
Viewed: 123 times

Categories

Visual Basic 6

Attachments

No attachments for this post


Loading Comments ...

Comments

No comments have been added for this post.

You must be logged in to make a comment.