472,353 Members | 2,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Using Uint in VB .NET

C# allows one to specify a constant with a type of uint, so you could have,
say:

private const uint varname = 0xFFFFFFF0

How does one port such statements to VB .NET?

--
http://www.standards.com/; See Howard Kaikow's web site.
Nov 21 '05 #1
6 12763
"Howard Kaikow" <ka****@standards.com> schrieb:
C# allows one to specify a constant with a type of uint, so you could
have,
say:

private const uint varname = 0xFFFFFFF0

How does one port such statements to VB .NET?


Currently that's not supported by VB.NET because VB.NET doesn't "natively"
support unsigned types (notice that the unsigned types are not CLS
compliant).

Untested:

\\\
Private ReadOnly varname As UInt32 = _
Convert.ToUInt32(&HFFFFFFF0)
///

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

Nov 21 '05 #2
I had tried something like that.

Error returned is "Value was either too large or too small for a UInt32."

The only things that "work" are

Private ReadOnly varname As Integer = &HFFFFFFF0
Const zz As Integer = &HFFFFFFF0

--
http://www.standards.com/; See Howard Kaikow's web site.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eH**************@tk2msftngp13.phx.gbl...
"Howard Kaikow" <ka****@standards.com> schrieb:
C# allows one to specify a constant with a type of uint, so you could
have,
say:

private const uint varname = 0xFFFFFFF0

How does one port such statements to VB .NET?


Currently that's not supported by VB.NET because VB.NET doesn't "natively"
support unsigned types (notice that the unsigned types are not CLS
compliant).

Untested:

\\\
Private ReadOnly varname As UInt32 = _
Convert.ToUInt32(&HFFFFFFF0)
///

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

Nov 21 '05 #3
Even if you get any of these variations to actually compile, it is still of
little use.
While VB.Net (pre 2005) does allow you to declare Unsigned Ints, there are
no operators.
You can add, subtract, etc. not even within the same data type.
Even simple compares will choke in many cases.

Gerald
Nov 21 '05 #4
that should read...
You can "NOT" add, subtract, etc...

"Gerald Hernandez" <Cablewizard@sp*********@Yahoo.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
Even if you get any of these variations to actually compile, it is still of little use.
While VB.Net (pre 2005) does allow you to declare Unsigned Ints, there are
no operators.
You can add, subtract, etc. not even within the same data type.
Even simple compares will choke in many cases.

Gerald

Nov 21 '05 #5
"Gerald Hernandez" <Cablewizard@sp*********@Yahoo.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
Even if you get any of these variations to actually compile, it is still of little use.
While VB.Net (pre 2005) does allow you to declare Unsigned Ints, there are
no operators.
You can add, subtract, etc. not even within the same data type.
Even simple compares will choke in many cases.


I understood that.

Fer now, I'm just passing a constant to a sub/function, so I can get by
cheating with Integer.
Nov 21 '05 #6

"Howard Kaikow" <ka****@standards.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
"Gerald Hernandez" <Cablewizard@sp*********@Yahoo.com> wrote in message
news:uq**************@tk2msftngp13.phx.gbl...
Even if you get any of these variations to actually compile, it is still

of
little use.
While VB.Net (pre 2005) does allow you to declare Unsigned Ints, there are no operators.
You can add, subtract, etc. not even within the same data type.
Even simple compares will choke in many cases.


I understood that.

Fer now, I'm just passing a constant to a sub/function, so I can get by
cheating with Integer.


As long as you resign yourself to using bit-wise operations only, then this
is your best bet. It is what I do, and it works quite well. If you need that
extra top bit, then the best thing to do is work with a Long (Int64).
Sometimes that extra bit is all you really need, it seems a shame to waste
another 32. But hopefully this will be solved with VB 2005.

Gerald
Nov 21 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: pvdm | last post by:
Hi, I am writing an app which encapsulates a multimedia timer. I implemented a TimerProc as static member function and a static member...
2
by: rawCoder | last post by:
Hi All, I have a *.cer file, a public key of some one and I want to encrypt some thing using this public key. Can someone point me to a sample...
4
by: Oliver | last post by:
Hello ! I am trying to get the unrar.dll working in C#... it seems that I correctly imported the functions as the first 2 function work without...
5
by: Ken | last post by:
Hello All, I am hoping someone has used the windows GDI AddPrinter API. What I need to know is how the private static extern bool...
2
by: mmmobasher | last post by:
Dear sirs after some googling i found some code to using unrar.dll, but i get runtime error System.NullReferenceException in line...
47
by: Bonj | last post by:
I downloaded the gzlib library from zlib in order to do compression. (http://www.gzip.org/zlib) The prototype of the compression function seems to...
4
by: Jerry | last post by:
I am trying to read a physical sector off of the disk (the boot sector for drive C:) from C#. I have no problems doing it from a C/C++ application...
0
by: Guy Mahieu | last post by:
Hi, I am trying to dynamically add menu items to external win32 applications from c# code. I have found some VB6 examples on the net that do just...
3
by: Charles Denny | last post by:
I'm trying to call CertFindCertificateInStore to find all certificates in the store that have the Code Signing enhanced key usage. I'm running into...
9
by: Sarath | last post by:
Why the following happening? UINT m_uArrXpos; UINT **p = m_uArrXposSchema; // Failed to compile UINT **p = (UINT**)m_uArrXposSchema; //...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.