Click here to Skip to main content
15,884,353 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all good people. Im migrating from vb6 to vb.net. Can please someone explain how to do this action: Open .bin file - then put a value of it on textbox or richtextbox or listbox, the point is that i will need to be able to send that value through UART

Any help appreciate it, Thanks

What I have tried:

Private Sub open_Click()
     SaveFileDialog1.Filter = "bin files{*.bin)|*.bin"
     If SaveFileDialog1.ShowDialog = System.Windows.Forms.DialogResult.OK _
     Then
         My.Computer.FileSystem.WriteAllText _
         (SaveFileDialog1.FileName, TextBox7.Text, True)
     End If
 End Sub
Posted
Updated 18-May-17 22:34pm
v3
Comments
Maciej Los 19-May-17 2:44am    
What kind of content you want to store in that binary file. Seems, you want to store text. Changing the file extension does not change the type of file. Got it?
You have to be more specific and provide more details, about your issue.
JeezyWonder 19-May-17 2:59am    
I want to open .bin, that bin contains 512 bytes with "1 byte space 1 byte space" pattern. You can see on that image http://imgur.com/a/C2lZc
Tomas Takac 19-May-17 4:31am    
Use the Reply button otherwise user won't be notified of your comment.
A question: why do you need to show arbitrary binary data in a textbox?

1 solution

Use a BinaryReader Class (System.IO)[^] to read the file. You will then need to do whatever processing is necessary to make the binary data into readable text which you then put in the textbox.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900