By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,572 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,572 IT Pros & Developers. It's quick & easy.

Constant definition

P: n/a
Dear all,

From forum, I found some constants definition like
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&

I wonder what is the meaning for sign & here?

--
Best regards,
RL
Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
That's some pretty old looking code. The & and % characters can be used as
type characters for Long and Integer (respectively). VB.NET includes them
only for historical purposes and their use is discouraged. You should
declare your variables instead:

Const ERROR_SUCCESS As Long = 0
Const ERROR_BADDB As Long = 1009

If you need to use a Long literal in code, use "L" instead of "&". (i.e.
123L)

"Lurc" <lu*****@spam.hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
Dear all,

From forum, I found some constants definition like
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&

I wonder what is the meaning for sign & here?

--
Best regards,
RL

Nov 21 '05 #2

P: n/a
Many thanks, Beth.

--
Best regards,
RL
"Beth Massi [Architect MVP]" <bm****@comcast.net> дʼ
news:eZ**************@TK2MSFTNGP09.phx.gbl...
That's some pretty old looking code. The & and % characters can be used as
type characters for Long and Integer (respectively). VB.NET includes them
only for historical purposes and their use is discouraged. You should
declare your variables instead:

Const ERROR_SUCCESS As Long = 0
Const ERROR_BADDB As Long = 1009

If you need to use a Long literal in code, use "L" instead of "&". (i.e.
123L)

"Lurc" <lu*****@spam.hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
Dear all,

From forum, I found some constants definition like
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&

I wonder what is the meaning for sign & here?

--
Best regards,
RL


Nov 21 '05 #3

P: n/a
Remember Beth that a Long in VB6 is an Integer in VB.Net and that an Integer
in VB6 is a Short in VB.Net.

Const ERROR_SUCCESS As Integer = 0
Const ERROR_BADDB As Integer = 1009
"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
That's some pretty old looking code. The & and % characters can be used as
type characters for Long and Integer (respectively). VB.NET includes them
only for historical purposes and their use is discouraged. You should
declare your variables instead:

Const ERROR_SUCCESS As Long = 0
Const ERROR_BADDB As Long = 1009

If you need to use a Long literal in code, use "L" instead of "&". (i.e.
123L)

"Lurc" <lu*****@spam.hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
Dear all,

From forum, I found some constants definition like
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&

I wonder what is the meaning for sign & here?

--
Best regards,
RL


Nov 21 '05 #4

P: n/a
Since the question was posted on a VB.NET forum I figured the code in the
original question was VB.NET, not VB6.

"Stephany Young" <noone@localhost> wrote in message
news:er**************@TK2MSFTNGP15.phx.gbl...
Remember Beth that a Long in VB6 is an Integer in VB.Net and that an
Integer in VB6 is a Short in VB.Net.

Const ERROR_SUCCESS As Integer = 0
Const ERROR_BADDB As Integer = 1009
"Beth Massi [Architect MVP]" <bm****@comcast.net> wrote in message
news:eZ**************@TK2MSFTNGP09.phx.gbl...
That's some pretty old looking code. The & and % characters can be used
as type characters for Long and Integer (respectively). VB.NET includes
them only for historical purposes and their use is discouraged. You
should declare your variables instead:

Const ERROR_SUCCESS As Long = 0
Const ERROR_BADDB As Long = 1009

If you need to use a Long literal in code, use "L" instead of "&". (i.e.
123L)

"Lurc" <lu*****@spam.hotmail.com> wrote in message
news:eb**************@TK2MSFTNGP10.phx.gbl...
Dear all,

From forum, I found some constants definition like
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&

I wonder what is the meaning for sign & here?

--
Best regards,
RL



Nov 21 '05 #5

P: n/a
"Lurc" <lu*****@spam.hotmail.com> schrieb:
From forum, I found some constants definition like
Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&

I wonder what is the meaning for sign & here?


In addition to the other replies:

Visual Basic Language Specification -- 2.2.1 Type Characters
<URL:http://msdn.microsoft.com/library/en-us/vbls7/html/vblrfVBSpec2_2_1.asp>

Visual Basic Language Concepts -- Type Characters
<URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vbconTypeCharacters.asp>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.