Hey guys. I was wondering if u could help me with some code i was working on. im making a program like notepad called wonder notes. so far its goin pretty good but i was wonder if u could help me with some code. i want the program to load a text file into the rich text box. heres my code for that.

    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click

        Dim OpenFileDialog1 As New OpenFileDialog()
        OpenFileDialog1.Filter = "Text File (*.txt)|*.txt |All Files |*.*"
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            RichTextBox1.Text = Text(OpenFileDialog1.FileName)
        End If

    End Sub

oh and while ur at it. can u help me make a new button 2. and a save/save as. thx!

Edited 4 Years Ago by Programmer629

My regular computer is in the shop and I don't have VB on my replacement but I think the RichTextBox control has a built in method for reading and writing files. I think they are called LoadFile and SaveFile.

Confirmed. Both methods have 2 overloads, Save method has same overloads

 LoadFile(String)   
 LoadFile(Stream, RichTextBoxStreamType)
 LoadFile(String, RichTextBoxStreamType)

I'm learner of vb.net Can anybody please explain what is opentoolstripe menu is?why we need overload ?sorry if troubled

yo! this is my problem, not urs. start ur own topic!!!

It makes more sense to ask it here where it is in context. In any case, it's just the name he gave to his menu control item.

This article has been dead for over six months. Start a new discussion instead.