How can I open a file and insert its contents into a TextBox?
thx, vbzero
Printable View
How can I open a file and insert its contents into a TextBox?
thx, vbzero
Code:'Open a file in binary mode and read into a textbox or string
Dim sHolder As String
Dim intNum As Integer
Dim sFileName As String
'open for binary and read
sFileName = "C:\My Documents\MyFile.txt"
intNum = FreeFile
Open sFileName For Binary As intNum
sHolder = Space(LOF(1))
Get #1, , sHolder
Close intNum
'assign the text to a textbox
Text1 = sHolder ' for a string (strString = sholder)
thx, vbzero
Code:Open "MyFile.txt" For Input As #1
Text1 = Input(LOF(1),1)
Close #1