0

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 by Programmer629

4
Contributors
5
Replies
11
Views
4 Years
Discussion Span
Last Post by Reverend Jim
1

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.

0

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

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

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

0

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 topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.