anyone know how what is UInt in C++ mean to VB.
I mean how to write in VB.net

Dani AI

Generated

A short, practical clarification that builds on the existing replies from , and : converting C++ integer types to VB.NET is mostly about matching bit width and intended signed/unsigned semantics, and then using explicit conversions and the correct .NET types when you move data (especially across APIs or files). The notes and examples below show the VB.NET aliases, how to convert safely, and what to watch for.

VB.NET provides unsigned aliases that correspond to the CLR unsigned types (use them when the C++ code expects unsigned widths). For example, the Visual Basic aliases UShort and UInteger map to System.UInt16 and System.UInt32 respectively; use the corresponding ULong for 64-bit unsigned values. (learn.microsoft.com)

Small sample declarations and literal syntax:

Dim a As UInteger = 3000000000UI
Dim b As UShort  = 65000US
Dim c As ULong   = 9000000000000000000UL

Use the literal type characters (ui, us, ul) if you want a literal forced to an unsigned alias. (learn.microsoft.com)

When converting runtime values, prefer explicit conversion functions (the VB conversion helpers such as CUInt/CUShort or the System.Convert methods) and handle overflow explicitly. The language provides inline VB conversion functions and the Convert class methods (Convert.ToUInt32, etc.); these will throw OverflowException for out-of-range values, so validate or catch exceptions as needed. Example:

Try
    Dim x As UInteger = Convert.ToUInt32(someValue)
Catch ex As OverflowException
    ' handle out-of-range values here
End Try

(learn.microsoft.com)

Interop notes and cautions: unsigned VB types are not CLS-compliant, and when calling native APIs or COM you must match the exact width the API expects (declare parms As UInteger / UShort / ULong as appropriate). Also consider compiler overflow checks and Option Strict to avoid silent narrowing; for Windows API declarations see the official guidance on calling functions that take unsigned types. (learn.microsoft.com)

Summary: prefer the VB unsigned aliases when the C++ type is unsigned, convert explicitly with CUInt/Convert.* and check for overflow, and match sizes exactly for interop.

Recommended Answers

All 2 Replies

See


C#/C++
short, ushort, int, uint, long, ulong

VB.NET
Short, Integer, Long


Or have it convert the code for you

Convert C# to VB.NET LINK

it means Unsigned integer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.