String to DWord

How can I turn a string into a Dword



Answer this question

String to DWord

  • Matthew Wiggins

    Dword

    http://en.wikipedia.org/wiki/Dword_%28Computer%29

    As a string is not specifically a numeric type although it can be converted to a numerical value - I'm rather asking the question of what context this is in.

    Is it a dword pointer to a string which is fairly common in API calls.

    The dword type is often used for interacting with Unmanaged API's - and "Dword" is not an intrinsic data type in the .NET Common Language Runtime.

    So without a bit more information about how your trying to use you may not get a good answer.


  • HyperKat

    My thought is that your probably trying to call an API

    if this is so, what API are you trying to call, there may be a simple way in the .NET Framework.


  • richqwerty

    OK , the following code will take a Hex value as a string and turn it into a 16, 32 or 64 bit integer value.

    Dim sHex As String = "FFE2"
    Console.WriteLine(sHex)

    Dim lng0 As Integer = Convert.ToInt16(sHex, 16)
    Console.WriteLine(lng0)

    Dim lng1 As Integer = Convert.ToInt32(sHex, 16)
    Console.WriteLine(lng1)
    Dim lng As Long = Convert.ToInt64("FF", 16)
    Console.WriteLine(lng1)


  • Toadkillerdog

    I have a string in hex form and im trying to turn it into a number. Its 4 bytes long so im trying to turn it into a word


  • RCHINTH

    Hey Josh,

    You could help help you if you gave us a little more to go because no one knows what kind of string you are talong about.

    A Dword itself is not well defined. I think it's 32 bit bit entity.

    You could always do the following:

    Dim as integer 32 = val("123456")

    That's not too exciting but that fits the bill of what you're asking for.



  • MarkX

    No im trying to turn a string into a dword.


  • String to DWord