|
[Vb.Net] You're Own Notepad.
|
|
07-20-2010, 11:21 AM
(This post was last modified: 07-20-2010 11:11 PM by Mitch.)
Post: #1
|
|||
|
|||
|
[Vb.Net] You're Own Notepad.
Hello SBrooks here with another tutorial.
This time we are gonna make our own notepad. Requirements: A Brain Visual.Basic 2008 And some knowledge. We starting with creating a new project. Name the project whatever you want. Then look at this pic and look careful how it should look.(optional) Tools added; Openfiledialog Savefiledialog Fontdialog Colordialog Richtextbox Menustrip. ![]() Now in the menustrip you shall add File,Edit,Format Look at the picture above. Under File add sub menustrips. New Open Save ----------- Exit. Like this: ![]() Under Edit add: Cut Copy Paste --------------- Redo Undo Like this: ![]() What you should add under Format: Font Color Ok now you're finished with making the gui. Very good job if you readed until here. Lets start with the coding huh. Im gonna post the whole source code but.. I will add comments of example what me.hide does bla bla bla. Source code starts here: Imports System.IO Public Class Form1 Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click Me.Close() 'closing program End Sub Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click RichTextBox1.Clear() 'clears the richtextbox End Sub Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click RichTextBox1.Cut() 'cuting the text End Sub Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click RichTextBox1.Copy() 'copy the text End Sub Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click RichTextBox1.Paste() 'paste the text you copied End Sub Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click RichTextBox1.Redo() 'redo the text End Sub Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click RichTextBox1.Undo() 'undo the text End Sub Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click Me.Close() 'close the program End Sub Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click Dim Save As New SaveFileDialog() 'making a shortcut word so you don't need to write the whole word Dim myStreamWriter As System.IO.StreamWriter ' hard to explain for me Save.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*" 'Makes that program only saves .txt files Save.CheckPathExists = True 'Checking if the destany you save to exist Save.Title = "Save File" ' the title of The savedialog Save.ShowDialog(Me)[color=#32CD32] ' svaving the text written in program Try 'trying myStreamWriter = System.IO.File.AppendText(Save.FileName) myStreamWriter.Write(RichTextBox1.Text) myStreamWriter.Flush() Catch ex As Exception End Try End Sub Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click Dim Open As New OpenFileDialog() ' making a shortcut word so you don't need to write the whole word Dim myStreamReader As System.IO.StreamReader ' hard to explain for me Open.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*" 'Makes that program only opens .txt files Open.CheckFileExists = True 'Checking if the file exist Open.Title = "OpenFile" ' the title of The opendialog Open.ShowDialog(Me) 'show opendialog Try ' trying Open.OpenFile() 'open the file myStreamReader = System.IO.File.OpenText(Open.FileName) ' hard to explain RichTextBox1.Text = myStreamReader.ReadToEnd() 'says that x means xx(Example) Catch ex As Exception End Try End Sub Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click FontDialog1.Font = RichTextBox1.Font 'says that x means xx(Example) FontDialog1.ShowDialog() ' Showing the fontdialog RichTextBox1.Font = FontDialog1.Font[color=#32CD32] 'Makes the choosed font appear when you write in program End Sub Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click Dim FC As New ColorDialog 'This do that when you write FC it means Colordialog Try 'Trying FC.ShowDialog() 'Showing the colordialog(FC) RichTextBox1.ForeColor = FC.Color [color=#32CD32]' making the choosed color in FC appear when you write in program Catch ex As Exception End Try End Sub End Class |
|||
|
07-20-2010, 11:22 AM
Post: #2
|
|||
|
|||
|
RE: Vb.Net You're Own Notepad.
Hmmm, I like this tut, it's actually fairly nice and the format is good!
|
|||
|
07-20-2010, 11:24 AM
Post: #3
|
|||
|
|||
|
RE: Vb.Net You're Own Notepad.
Thanks this tut is fully written by me and so its the code.
It took me around 20mins to write this tut |
|||
|
07-26-2010, 09:25 AM
Post: #4
|
|||
|
|||
|
RE: [Vb.Net] You're Own Notepad.
wow tahnk .. actually thats my home work.. hahaha thank you vry much.. im so tired working on it..
but you save me.. you rocks.. not i can pass my home work.. im licked it to my class mates.. ill shared it . cause you shared it to me .. tahnk you again .. and its nice to meet person like you.. you deserve a thanks.. ill hit thanks button for you.. |
|||
|
07-29-2010, 05:46 AM
Post: #5
|
|||
|
|||
|
RE: [Vb.Net] You're Own Notepad.
Nice source brother.
I had made one too but it was in VB6 |
|||
|
08-03-2010, 07:20 PM
Post: #6
|
|||
|
|||
|
RE: [Vb.Net] You're Own Notepad.
Wow, thats looks very impressive, definitely gonna try this tutorial.
|
|||
|
08-05-2010, 07:30 AM
Post: #7
|
|||
|
|||
|
RE: [Vb.Net] You're Own Notepad.
Amm, meybe it is fun, but what's the point of creating notepad? You better make tutorials for some usefull programs, like mp3 player :) That would ge owesome!
|
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread:



![[Image: 2crpob9.png]](http://i28.tinypic.com/2crpob9.png)
![[Image: 25s7i20.png]](http://i30.tinypic.com/25s7i20.png)
![[Image: 2v1ni4j.png]](http://i30.tinypic.com/2v1ni4j.png)


