VB 2008 Tutorial - How to make Advanced Notepad

Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
4 posts Page 1 of 1
Contributors
User avatar
tvs praveen
Top Poster
Top Poster
Posts: 205
Joined: Tue Dec 08, 2009 6:20 am

Insert a MenuStrip, RichTextBox, OpenFileDialog and SaveFileDialog hehaho; hehaho;

Now in MenuStrip add a Menu "File"

Under "File" Menu add items New, Open, Save, Print Document and Exit

Now in MenuStrip add a another Menu "Edit"

Under "Edit" Menu add Copy, Paste, Cut add one Seperator, Then add Select All, Clear All, Font Settings, Select Color, Again add one Seperator, Then add Undo and Redo

Now double click each items in MenuStrip and add these following codes into it

Code for "New" item in MenuStrip
Code: Select all
RichTextBox1.Text = ""
MsgBox("New Text Document!")
Code for "Open" item in MenuStrip
Code: Select all
Dim alltext As String = "", lineoftext As String = ""
OpenFileDialog1.Filter = "All Files | *.*"
OpenFileDialog1.ShowDialog()
If OpenFileDialog1.FileName <> "" Then
End If
Try
FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input)
Do Until EOF(1)
lineoftext = LineInput(1)
alltext = alltext & lineoftext & vbCrLf
Loop
RichTextBox1.Text = alltext
Catch
Finally
FileClose()
End Try
Code for "Save" item in MenuStrip
Code: Select all
SaveFileDialog1.Title = "Save A Text Document"
SaveFileDialog1.Filter = "Text Document | *.text | all files | *.*"
SaveFileDialog1.ShowDialog()
If SaveFileDialog1.FileName <> "" Then
FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
PrintLine(1, RichTextBox1.Text)
FileClose(1)
End If
Code for "Print Document" item in MenuStrip
Code: Select all
Dim AB As New PrintDialog
Try
AB.ShowDialog()
RichTextBox1.Text = AB.PrintToFile
Catch ex As Exception
End Try
Code for "Exit" item in MenuStrip
Code: Select all
Me.Close()
Code for "Copy" item in MenuStrip
Code: Select all
RichTextBox1.Copy()
Code for "Paste" item in MenuStrip
Code: Select all
RichTextBox1.Paste()
Code for "Cut" item in MenuStrip
Code: Select all
RichTextBox1.Cut()
Code for "Select All" item in MenuStrip
Code: Select all
RichTextBox1.SelectAll()
Code for "Clear All" item in MenuStrip
Code: Select all
RichTextBox1.Text = ""
MsgBox("Text Cleared!")
Code for "Font Settings" item in MenuStrip
Code: Select all
Dim FS As New FontDialog
Try
FS.ShowDialog()
RichTextBox1.Font = FS.Font
Catch ex As Exception
End Try
Code for "Select Color" item in MenuStrip
Code: Select all
Dim FC As New ColorDialog
Try
FC.ShowDialog()
RichTextBox1.ForeColor = FC.Color
Catch ex As Exception
End Try
Code for "Undo" item in MenuStrip
Code: Select all
RichTextBox1.Undo()
Code for "Redo" item in MenuStrip
Code: Select all
RichTextBox1.Redo()

*******************Thanks for reading my tutorial, I think this Tutorial will be most helpful to you!*******************

If you want any custom tutorial for you or you need any help in VS.NET, VB.NET, Software Coding, Designing and much more any help in Computer stuffs just ask me

Mostly i will help everyone in coding and design stuffs in on Computer

- Best regards hehaho;

- Tvs Praveen wahooo;

- Thanks CodeNStuff! for this amazing Website cooll;
User avatar
pro67
Just Registered
Just Registered
Posts: 2
Joined: Fri Mar 26, 2010 9:41 pm

When i save the page and open it again the color is gone
User avatar
Noob.exe
Top Poster
Top Poster
Posts: 233
Joined: Wed Mar 31, 2010 6:42 pm

when you change color save value to my.settings and use it in new page
<3 VB & Python
User avatar
arno
Just Registered
Just Registered
Posts: 5
Joined: Wed Apr 14, 2010 7:34 pm

cool tut i realy like it
4 posts Page 1 of 1
Return to “Tutorials”