Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

loadFile statement. - Newbie question 1

Status
Not open for further replies.

RSX02

Programmer
May 15, 2003
467
CA
Hi
I'm just new with vb.net so my question might seem to be a newbie question.

I'm trying to open a document from my code.
here it is:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Me.OpenFileDialog1.ShowDialog() = DialogResult.OK Then
Me.RichTextBox1.Text = ***.LoadFile(OpenFileDialog1.FileName)

End If
End Sub

I don't know what to put instead of the ***.
I took my code from an example but it was with an image. not text. What I should put there?
Thanks in advance
 
I think the easiest way is just to use :

Me.RichTextBox1.LoadFile(OpenFileDialog1.FileName)

I know that it is done this way in VB 6 and probably in VB.Net to.

To search or to post - that is the question.
To search first and to post later. THAT is the answer.
 
Thanks.
I thought that I already tried it but it seems that I didn't.
:)
 
no problem,

By the way, You can drop the 'Me' part of the code.

It works non the less but you only have to add the forms name before a control if you want to call it from another form.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top