NOTE: The All words are no loner caps is not my problem that was off topic!
Ok I have Made A HEX Editor But It Has A Few Things That I dont Want Or Need To Be Fixed And I Need Your Guys Help.
1. So for first i have made a OpenFileDialog right so when clicked it askes to load a file well I have made it so it translates normal text format to HEX format well but for some reason it creates a backup once i load a file is there any way to remove that so it doesnt create a backup? Here is my code!
2. I can't seem to figure out the code ok now what I am trying to do is make A SaveFileDialog that when clicked it askes to save the text in my textbox but when i save it saves in HEX format is there a code to translate HEX back to normal text format? I found a code here on this site with some other users help and thanks but this is the opposite code than i need what this code does is translate normal format to HEX but i want it to translate HEX to normal format! Here is my code!Code:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim OpenFileDialog As New OpenFileDialog OpenFileDialog.InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments OpenFileDialog.Filter = "All Files (*)|*|All Files (*.*)|*.*" If (OpenFileDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK) Then Dim FileName As String = OpenFileDialog.FileName Dim sw As New IO.StreamWriter("Backup!") Dim s As String = System.IO.File.ReadAllText(OpenFileDialog.FileName) Dim encoding As New System.Text.ASCIIEncoding() Dim b As Byte() = encoding.GetBytes(s) Dim sb As New StringBuilder() For Each singleByte As Byte In b sb.AppendFormat("{0:x2}", singleByte) Next TextBox1.Text = sb.ToString() sw.Write(TextBox1.Text) sw.Close() MsgBox("File Loaded!") End If End Sub
Code:Dim aryText As String Dim FILE_NAME As String If SaveFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then FILE_NAME = SaveFileDialog1.FileName aryText = Textbox1.Text Dim byt() As String = Array.ConvertAll(aryText.ToCharArray, New Converter(Of Char, String)(Function(X) Microsoft.VisualBasic.Asc(X).ToString("X"))) Using objWriter As New System.IO.StreamWriter(FILE_NAME) Array.ForEach(byt, AddressOf objWriter.Write) End Using End If__________________




Reply With Quote