ai3rules
04-21-2004, 01:39 PM
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.
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.