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()
If CommonDialog1.FileName <> "" Then Textbox.Text = CommonDialog1.Filename
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.
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.
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)