Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

[Help] Hex Editor, Organize Hex using RichTextBox [Help]

I'm trying to organize the Hexadecimals of a file into how normal hex editors look.

Here is the code im using to show the file's hex in the richtextbox.
Code
Dim myFile As String = OFD.FileName
        Dim myBytes As Byte() =
My.Computer.FileSystem.ReadAllBytes(myFile)
        Dim Temp As New System.Text.StringBuilder()
        For Each myByte As Byte In myBytes
            Temp.Append(myByte.ToString("X2"))
        Next
        RichTextBox1.Text = Temp.ToString()

Here is what it looks like and heres what I want it too look like
[img]http://localhostr.com/file/UwjOEHT/tmpBDE.jpeg[/img]
[img]http://mh-nexus.de/en/graphics/HxDShotLarge.png[/img]
Change
Code
For Each myByte As Byte In myBytes
    Temp.Append(myByte.ToString("X2"))
To
Code
Dim inc as Integer = 0
For Each myByte As Byte In myBytes
    Temp.Append(myByte.ToString("X2") + " ")
    If inc Mod 16 = 0 Then Temp.Append(Chr(13))
    inc = inc + 1
Next myByte

I think that works (very basically). I'm a C# coder. Also don't forget to change the textbox font to Courier New.
ヽ༼ຈل͜ຈ༽ノ
you can use hexbox it'S a simple .... that you can use ...
http://sourceforge.net/projects/hexbox/

~BlueC0der


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by PerileosMay 11, 2020 09:21 PM 24 603 May 11, 2020 09:21 PM
Last Post: Alien
[C#] by SkofosAug 20, 2019 09:56 AM 49 1,618 Aug 20, 2019 09:56 AM
Last Post: MavenGradle
[Shell] by SkofosJul 19, 2019 06:19 PM 2 219 Jul 19, 2019 06:19 PM
Last Post: Skofos