Dear Friends
How can i convert file into its hex in vb.net or any programming language???

Recommended Answers

All 2 Replies

If you just want to see the hex values you can download any of a number of freeware hex editors. You can also download the TextPad demo and use it to open an exe file. It will display in hex.

For free hex editors just go to google and search on "free hex editor"

If you need to do it in code I can write you a bit of vbScript or vb.net.

Hi!

Here is the vb.net code:

Dim text As String = IO.File.ReadAllText("YouPathOfFile")
        Dim bytearray() As Byte = Encoding.ASCII.GetBytes(text.ToCharArray())
        Dim Hex As String = String.Empty
        For Each b As Byte In bytearray
            Hex &= Convert.ToString(b, 16)
        Next
        System.Diagnostics.Debug.Print(Hex) 'see result in "Output window"

and here is the link for verification of file in form of byte:
http://www.string-functions.com/string-hex.aspx

This link will help you if you will be going wrong.

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.