baby_vb Posted November 3, 2003 Posted November 3, 2003 Can someone please tell me how to use a UInt32 type and access and set its values? I'm trying to call a DLL method that has one of its parameters as a UInt32 type. The parameter is just the baud rate of a connection I'm setting up, so I want to set or hard code that value somewhere before it's called. But how do I pass the value in if the method is expecting a UInt32? Thank you for helping Quote
*Experts* Volte Posted November 3, 2003 *Experts* Posted November 3, 2003 UInt32 is not CLR-compliant and should not be used. Instead, Int64 (Long) should be used. However, if you have no control over it:Dim num As UInt32 = Convert.ToUInt32(<your number>)That should do the trick. Quote
*Experts* Nerseus Posted November 4, 2003 *Experts* Posted November 4, 2003 Is the DLL called using DllImport or through a .NET or COM reference? If it's using DllImport, I'd bet you could define the parameter in VB.NET as Int32 and pass your value - technically an unsigned and signed int are the same except how math is performed. And since you're passing a baud rate, which is well within the signed int's range, you shouldn't have any problems. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
baby_vb Posted November 6, 2003 Author Posted November 6, 2003 The DLL is called through a .NET reference. And I never did figure out why they defined a baud rate as an unsigned integer type, instead of regular old integer. In any case, thanks VolteFace, your code worked great! :D Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.