posting from a file

  • 11 years ago

    Code:

    On Error GoTo errHandler
    With cd1
       .CancelError = False
       .DialogTitle = "Open"
       .Flags = cdlOFNHideReadOnly + cdlOFNPathMustExist + cdlOFNFileMustExist
       .Filter = "GSC Files (.gsc)|.gsc"
       .FileName = ""
       .ShowOpen
    End With
       Open cd1.FileName For Input As #1
       Print #1, txtDocument.Text
       Close #1
       
    errHandler:
      Exit Sub


    for some reason when i use commondialog1 to open a file it will not post into the txtdocument.text window at all...
    am i missing something here?


    Wildturkey

  • 11 years ago
    I've only just come back to work after the hols so haven't seen your post before now, apologies if I'm too late!!

    I believe your problem lies in the fact that you are opening the file for input but you are using the Print statement!

    It should read:

    Open cd1.FileName For Input As #1
    Line Input #1, txtDocument.Text
    Close #1

    Regards,

    Bob

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There are only 3 numbers of interest to a computer scientist: 1, 0 and infinity”