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

cannot assign 1000 to uInt32 variable

P: n/a
Ron
Dim x As UInt32
x = 1000

Value of type 'Integer' cannot be converted to 'System.Uint32'.

Why is this illegal?
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"Ron" <Ro*@discussions.microsoft.com> schrieb:
Dim x As UInt32
x = 1000

Value of type 'Integer' cannot be converted to 'System.Uint32'.

Why is this illegal?


VB.NET 2002/2003 do not support unsigned integer types. Note that these
types are not CLS-compliant and thus their use should be avoided. VB 2005
will support unsigned integer types, and these types will IIRC become
CLS-compliant. In current versions of VB.NET, you may want to use the code
below instead of the code you included:

\\\
Dim u As UInt32 = Convert.ToUInt32(1000)
///

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

Nov 21 '05 #2

P: n/a
Unsigned Integers aren't used in VB.NET, but are in C etc.

Just do:

Dim intX As Integer = 1000

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #3

P: n/a
Ron
Thanks!

"Herfried K. Wagner [MVP]" wrote:
"Ron" <Ro*@discussions.microsoft.com> schrieb:
Dim x As UInt32
x = 1000

Value of type 'Integer' cannot be converted to 'System.Uint32'.

Why is this illegal?


VB.NET 2002/2003 do not support unsigned integer types. Note that these
types are not CLS-compliant and thus their use should be avoided. VB 2005
will support unsigned integer types, and these types will IIRC become
CLS-compliant. In current versions of VB.NET, you may want to use the code
below instead of the code you included:

\\\
Dim u As UInt32 = Convert.ToUInt32(1000)
///

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

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.