Link to home
Start Free TrialLog in
Avatar of aijohn
aijohn

asked on

Printing a text file in a textbox

Need code that will print a text file in a textbox when a node in treeview is clicked.  Also,is listview or textbox more appropriate for this?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of FRoeCassNet
FRoeCassNet

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jacamar
Jacamar

Unless you want to edit the text, I would suggest doing this to a label.  The string will run of the end, while the label will act more like a text file, and print the text on the next line of the label when it reaches the end.

same as above except use

Label1.Caption = String


Hope this is of use
Dear aijohn,

th code for putting the entire content of the text file to the text box is:

Private sub GetFile(byval strFile as string)
   dim strContents
   
   on error goto ErrHandler
 
   Open strFile For Input As #1
        strContents = Input(LOF(1), #1)
   Close #1

   Text1.text = strcontents
   Exit sub

ErrHandler:
   msgbox "error occured"
End sub