posting from a file

  • 12 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

  • 12 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.

“Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.” - Antoine de Saint Exupéry