how to define a constant in VB

  • Thread starter Thread starter Maileen
  • Start date Start date
M

Maileen

Hi,

I would like to know how to define a constant in VB.NET.
i've tried #CONST strMyString = 1001

in my code laster, i use this constant, but VB.NET is telling me that it can not be converted due to my "Explicit Off" option.
I tried to convert it in long, but nothing change...

so where can be the issue ?
thx,

Maileen
 
i just would like to precise my thought.
i can define a constant like that :

public const strTest as Long = 1001

I know that it will work, but i'm looking for something like in C++ : #define test 1001

Maileen
 
Maileen said:
i can define a constant like that :

public const strTest as Long = 1001

I know that it will work, but i'm looking for something like in C++ :
#define test 1001

I suggest to use a constant! VB.NET doesn't support text-replacements as
possible with '#define' in C/C++.
 
Back
Top