VB binary preservation issues, seeking God

TXTBOX box inside the content is "hello"
Save the box's contents to a text file "123.txt" according to binary
Code should be how to write it?
I find on the Internet for two days, there is no good way to find ah

Started by Gustave at February 11, 2016 - 2:41 PM

f=freefile()
open "123.txt" for output as #f
print #f,TXTBOX.Text
close #f

Posted by Wright at November 30, 2016 - 10:46 AM

Recommend the use of WinHex software to view the original byte hard disk or file or in memory.

Posted by Wright at December 08, 2016 - 10:50 AM

Guess what you mean
Want to put text into a binary ASCII code to explicitly saved to the TXT?

For example, the input A
Ascii(A)= Hex(41)=Bin(1000001)
The text TXT saved is 1000001

Posted by Ronald at December 18, 2016 - 11:09 AM

"According to preserve binary "is what mean?

All data are based on the binary code of the preservation and transmission. It is such as Notepad software in the open.Txt file by default the data according to ASCII code interpretation, so we see the text.

You use the UltraEdit software to open it, choose the binary code display, see its true colors.

Posted by Clark at December 29, 2016 - 11:51 AM

Open "123.txt" For Binary As #1
Put #1, , TXTBOX.Text
Close #1

Posted by Evan at December 30, 2016 - 12:22 PM

I'm new learning.

Posted by Sampson at January 04, 2017 - 1:21 PM


Dim fd As Integer, _
byArray() As Byte
'// Converts the string into an array of bytes.
byArray = StrConv(text1.Text, vbFromUnicode)
'// A valid file number
fd = FreeFile()
'// Open the specified file in binary mode, the file does not exist will create the file
Open "yourfile.txt" For Binary As #fd
'// Output byte array data to the current file read and write position (default file at the beginning)
Put #fd, , byArray
'// Close the file
Close #fd

Posted by Jessie at January 10, 2017 - 2:18 PM

This article has a custom function named SaveTextFile, you can look at the

Posted by Jessie at January 13, 2017 - 2:26 PM