Click here to Skip to main content
13,794,217 members
Rate this:
 
Please Sign up or sign in to vote.
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 18-May-17 18:00pm
Updated 18-May-17 23: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

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.181207.3 | Last Updated 19 May 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100