|
-
Jan 10th, 2000, 12:03 PM
#1
Thread Starter
Hyperactive Member
Hi,
I'm learning API and I offten see the Const command but I don't have a clue what it is and does. Could you please tell me?
Thanks
-
Jan 10th, 2000, 12:11 PM
#2
It means Constant, a Variable who's value doesn't change.
When using things like Window Styles it's easier to code WM_BORDER, or WM_DLGFRAME, rather than trying to remember the actual values.
VB uses a whole host of Constants, ie.
WindowState = vbMinimized
vbMinimized is a Constant with a value always of 1
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
Jun 12th, 2002, 07:14 PM
#3
A variable must change, hence it's name... if it were constant, it wouldn't be a variable!
A better explanation would be that a constant has a particular value which doesn't change.
-
Jun 12th, 2002, 07:23 PM
#4
PowerPoster
In the declarations section of a Module, you can declare a const as public or private. You can also use Dim, but that's not recommended.
You must use Dim if you declare a const in a procedure. I don't think you can have a public const in a form or a class module.
Also, you can declare the data type of the const
All these are legal in a module but you can only have one of them since the name is the same.
VB Code:
Public Const MY_CONSTANT As Long = 1
Public Const MY_CONSTANT = 1
Private Const MY_CONSTANT As Long = 1
Private Const MY_CONSTANT = 1
Dim Const MY_CONSTANT =1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|