Hello CodeCall ..
Today i'm Gonna show how to make an advanced Notepad in Visual Basic 2008 Express Edition ...
The Notepad will look like this photo ..
Let's Start ..
Create a Project
Increase the Size of Form1 and Rename with " Your Name.. Notepad "
Make a Rich Text Box and size like in photo ..
As u see in photo u need a little Space There ...
After That you should create some Menu Strips In The Little Space that you let in the picture Above ..
These Menu Strips will look like this ..
The menu Strip with the name File , make like this photo ..
So Let's Work here ..
1.Code For the menu Strip named NEW will be ..
2.Code for the menu Strip named Open we should add an OPENFILEDIALOG from ToolBox and the code isCode:RichTextBox1.Text = ""
Code: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(1) End Try
3.For the menu Strip named SAVE we should add an SAVEFILEDIALOG from ToolBox and the code is
4.For the menu Strip named PRINT add a PRINT DIALOG from toolbox and the code isCode:SaveFileDialog1.Filter = "TextDocuments |*.txt |All Files|*.*" SaveFileDialog1.ShowDialog() If SaveFileDialog1.FileName <> "" Then FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output) PrintLine(1, RichTextBox1.Text) FileClose(1) End If
5.For the menu Trip EXIT code isCode:Dim AB As New PrintDialog Try AB.ShowDialog() RichTextBox1.Text = AB.PrintToFile Catch ex As Exception 'Again, do nothing on exception End Try
after that just Add a Numeric UpDown (no in the RichTextBox)..Code:End
Now let's go to the menustrip EDIT that looks like this ..
1.For the UNDO code is
2.For the REDO code is :Code:RichTextBox1.Undo()
3.For the CUT code is :Code:RichTextBox1.Undo()
4.For the COPY code is :Code:RichTextBox1.Cut()
5.For the PASTE code is :Code:RichTextBox1.Copy()
6.For the SELECT ALL code is:Code:RichTextBox1.Paste()
7.For the CLEAR ALL code is :Code:RichTextBox1.SelectAll()
Go To the menustrip named FORMAT that will look like this ..Code:RichTextBox1.Text = ""
1.For the menustrip named FONT add a FONTDIALOG and the code is
2.For the menustrip named COLOR adda a COLORDIALOG from toolbox , code isCode:Dim FS As New FontDialog Try FS.ShowDialog() RichTextBox1.Font = FS.Font Catch ex As Exception 'Do nothing on exeption End Try
...Code:Dim FC As New ColorDialog Try FC.ShowDialog() RichTextBox1.ForeColor = FC.Color Catch ex As Exception 'Again, do nothing on exception End Try
Finally , Test it ..
Best Wishes ,
Mendim.
Notepadi.rar
Very neat! +rep
Nice job. It's things like this that make languages meaningful![]()
Good tutorial, +rep.
Interested in participating in community events?
Want to harness your programming skill and turn it into absolute prowess?
Come join our programming events!
Stunned, VB is sure really good language, also good work mendim !
The .NET Framework, and all languages in general that target it are stunning.
*Gets gun out to shoot C/C++/Assembly code purists*
Interested in participating in community events?
Want to harness your programming skill and turn it into absolute prowess?
Come join our programming events!
Thanks from all ..
Mendim.
huhu , don't understand nothing .. :s ..
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks