Hello guys
when i open .net exe file in notepad i will get string like this in image
How can i get this string programmatically and put in TextBox
Thank you :)
http://im82.gulfup.com/cOtoVv.png
Printable View
Hello guys
when i open .net exe file in notepad i will get string like this in image
How can i get this string programmatically and put in TextBox
Thank you :)
http://im82.gulfup.com/cOtoVv.png
You would get the text contents of that file the same way you would get the text contents of any file, the simplest way being to call File.ReadAllText. You may have to specify a particular Encoding to get the same result as Notepad produces. I'm guessing that it would use UTF8 but I'm not 100% sure.
Thank you mr. jmcilhinney , but it gives me only this result in image .. when i use this code
Code:Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim StrArray = System.IO.File.ReadAllLines("c:\WindowsApplication1.exe", Encoding.UTF8)
For Each L In StrArray
TextBox1.AppendText(L.ToString & vbNewLine)
Next
End Sub
it's not all the string!!
http://im80.gulfup.com/QFEwrs.png
Do as I instructed.
if you mean this code
Code:TextBox1.Text = System.IO.File.ReadAllText("c:\WindowsApplication1.exe", Encoding.UTF8)
it gives me only this
http://im51.gulfup.com/rf94ac.png
Did you try different Encodings?
i try it all .. and no result
An .exe file will almost certainly contain bytes with value = 0. When converting the .exe to a string, these will typically be treated as Null chars (depends to some extent on the Encoding being used).
A Null char is considered by many languages to indicate the end of the string. When Windows renders text, any characters following a Null char are not rendered.
In order for Notepad to display the text as it does, it seems to replace Null chars (bytes whose value = 0) with Spaces (bytes whose value = 32).
You need to do the same if you want your output to look like Notepad's.
I think the encoding used in Notepad by default is an ANSI encoding, which would be Encoding.Default for me. Probably the same for you, but I'm not 100% sure. Something you can research.