Reputation: 294
I noticed that when you open an .exe
file in notepad, it shows up like this:
But when you open it into a windows forms textbox, it looks like this:
It's not just for .exe files either. the same thing happens with anything thats not plain text.
Can somebody tell me how I can make my textbox do that?
Upvotes: 4
Views: 68
Reputation: 1616
Found the problem, the winforms's textbox stops rendering text when it finds a null byte. You can verify it like this:
textBox1.Text = "Hello\0World";
It'll just show the "Hello" part.
Upvotes: 3
Reputation: 14389
it seems like an encoding issue. View the encoding used in notepad and force your textbox to have the same, e.g
textBox1.Text = File.ReadAllText(file,Encoding.UT8);
Upvotes: 0