cannot assign 1000 to uInt32 variable

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dim x As UInt32
x = 1000

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

Why is this illegal?
 
Ron said:
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)
///
 
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
 
Thanks!

Herfried K. Wagner said:
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)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top