Results 1 to 6 of 6

Thread: [Resoved] Text Reader Help

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2006
    Posts
    11

    Resolved [Resoved] Text Reader Help

    hi!
    i have a Text Editing software where i can load any .txt file.
    this works perfectly just i want to get rid of the error message " file cannot be found" and replace it with a msg box saying some thing like "Windows cannot fild the file "abc" , please make sure you have typed the name correctly."
    here is the code i have created

    VB Code:
    1. Private Sub cmdLoad_Click()
    2.  
    3. Dim strName As String
    4. Dim strFile As String
    5. Dim strTemp As String
    6.  
    7.     strName = InputBox("Filename:") ' file name to load
    8.     Open "C:\" & strName & ".txt" For Input As #1 ' loaded file
    9.         strFile = ""
    10.             Do Until EOF(1)
    11.                     Line Input #1, strTemp
    12.                     strFile = strFile & strTemp & vbCrLf
    13.             Loop
    14.             txtout.Text = strFile 'print file to textbox
    15.     Close #1
    16.  
    17. End Sub
    Thx in advance!!
    Last edited by Mick Grey; Oct 7th, 2006 at 11:52 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width