Click here to Skip to main content
13,862,653 members
Rate this:
Please Sign up or sign in to vote.
See more:
Hello all good people. Im migrating from vb6 to 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 _
         My.Computer.FileSystem.WriteAllText _
         (SaveFileDialog1.FileName, TextBox7.Text, True)
     End If
 End Sub
Updated 18-May-17 23:34pm
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
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
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.

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
Web05 | 2.8.190214.1 | Last Updated 19 May 2017
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

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