473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

integer ->System.Unit32

Dear all,
how do I convert a .NET integer into System.Uint32 (needed to call external
function)
Thanks,
Boni
Nov 21 '05 #1
5 4159
Convert.ToUint32

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

"Boni" <oilia@nospam> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
Dear all,
how do I convert a .NET integer into System.Uint32 (needed to call
external function)
Thanks,
Boni

Nov 21 '05 #2


"Boni" <oilia@nospam> wrote in message
news:ua**************@TK2MSFTNGP12.phx.gbl...
:
: Dear all,
: how do I convert a .NET integer into System.Uint32 (needed to call
: external function)
: Thanks,
: Boni
I assume by 'external function' you mean a function in a .DLL that isn't
part of dot net (e.g.: a windows API call or similar) in which case, the
function is expecting an unsigned 32 bit integer as a parameter and / or
returns the same. Correct?
This isn't my strong suit but I believe you can simply specify an
integer (System.Int32) and use it whereever the funtion specifies. The
external function shouldn't care if vb considers the value signed or
not- only that it has the correct number of bits. The problem in vb is
it doesn't support using unsigned integer values. It only supports
signed integers (System.Int32).
If you need to assign the value of the integer to some value greater
than 2147483647 (the positive upper limit of an Int32 value) before
passing to the function, you can use hex notation. For example, if you
need to supply the value 3000000000, you could use the notation
&HB2D05E00. Beyond that however, you are limited to treating the value
as signed.
I guess what I'm saying is, I believe you can pass Int32 values in and
out of external functions that expect unsigned 32 bit integers without
issue, but you cannot manipulate them in your code as such - your system
will always see them as being signed. (Note, C# does support unsigned
integers and may be more suited for your purposes in this instance).
Ralf
Nov 21 '05 #3
Hi Boni,

Use Convert.ToUInt32().

Roman
"Boni" <oilia@nospam> ñîîáùèë/ñîîáùèëà â íîâîñòÿõ ñëåäóþùåå:
news:ua**************@TK2MSFTNGP12.phx.gbl...
Dear all,
how do I convert a .NET integer into System.Uint32 (needed to call external function)
Thanks,
Boni

Nov 21 '05 #4
"Boni" <oilia@nospam> schrieb:
how do I convert a .NET integer into System.Uint32 (needed to call
external function)


In VB.NET 2002/2003 you can use 'Convert.UInt32'. VB 2005 natively supports
unsigned numeric types.

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

Nov 21 '05 #5
VB.NET 2005 fully supports unsigned integer types. If you need it in
production before 2005 is released then use _AnonCoward's suggestion.
--
David Anton
www.tangiblesoftwaresolutions.com
Home of:
Clear VB: Cleans up outdated VB.NET code
Instant C#: Converts from VB.NET to C#
Instant VB: Converts from C# to VB.NET
Instant J#: Converts from VB.NET to J#

"Boni" wrote:
Dear all,
how do I convert a .NET integer into System.Uint32 (needed to call external
function)
Thanks,
Boni

Nov 21 '05 #6

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

Similar topics

1
by: Ted | last post by:
I have some code which processes an xsd. For elements of type xs:integer the XmlSchemaDatatype object gotten from the schema elements ElementType member contains a ValueType of System.Decimal. I...
36
by: AussieRules | last post by:
Hi, I want to use the user color scheme to set the color of my forms. I now I have to use the. System.Drawing.SystemColors, but which color is the color of a form background as used in other...
8
by: Sueffel | last post by:
Okay, I can certinatly use a For..Next loop to find the specified info I need, but I'm thinking the BinarySearch will be faster, if I can get it working LOL Anyhew, got an array, may have 5 or...
5
by: Barry | last post by:
Hello, In VS2003, I tried using an enum and setting it into a field in a datarow. It seems as if the datatype of the field in the row determined what went into the field. If the datatype was...
6
by: Arthur Dent | last post by:
How do you sort a generic collection derived from System.Collections.ObjectModel.Collection? Thanks in advance, - Arthur Dent
0
by: Nickneem | last post by:
I' m trying to disable all right mouse clicks by using the vbAccelerator Windows Hooks Library The small (systray / console) app. must catch all (right) mouseclicks before they are received by...
2
by: fniles | last post by:
In VB6, we use Integer and Long. In VB.NET does Integer becomes Int32 and Long becomes Integer ? Thanks.
22
by: schneider | last post by:
I need to hook the system mouse down event. I'm trying to replicate how a context menu hides when the mouse clicks outside of the control. Thanks, Schneider
6
by: joegao1 | last post by:
can anyone help here? I am working on an embedded system with a C-like programming language, therefore floating point operation is not allowed (because it is time consuming), and floating point...
2
by: lily86 | last post by:
i'm very new so i hope all of u can help me. when i debug my webforms this error occur "An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll Additional...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.