dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Simple VB Question

  1. #1
    Join Date
    May 2003
    Location
    New York
    Posts
    279

    Simple VB Question

    I am literally just starting to learn VB, and I am reading a book which gave me an sample word processor to put together. It seems to work fine, except for one click event.

    Private Sub cmdOpen_click()
    CommonDialog1.ShowOpen
    If CommonDialog1.FileName <> "" Then Textbox.Text = CommonDialog1.Filename
    End Sub

    When I run that, it loads the "Windows open dialog" box. However, when I select a .txt file to open - instead of displaying the contents of the text file (like I am assuming it is supposed to) it displays the path of the file in the text box.

    Can anyone tell me what I am doing wrong?

    I hope I am asking this in the correct forum - people here seem to know everything, so I thought it was my best bet.

    Anyway, I appreciate any help.
    Thank You.

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    Your not doing anything wrong, nor is the application you wrote.

    The preceding code will prompt the user with the standard Windows 'File Open' dialog, wait for a selection, and then display the path of the file which was chosen.

    To actually display the contents of the text file would take more code. You will probably get to that later in the book you are reading.

    Also, please post any VB related questions in the .NET forum.

    Regards,
    Andrew Buntine.

  3. #3
    Join Date
    May 2003
    Location
    New York
    Posts
    279
    Hi, I was hoping that was the case - Thank you for you reply.

    I will post further VB questions in the .net forum, thanks for the heads up.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles