*Detailed* Notepad Tutorial
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.
5 posts
Page 1 of 1
Download Full project at viewtopic.php?f=70&t=495 (Scroll down)
Contains:
<3 forms>
Form1:
- 1 fontdialog
- 1 colordialog
- 1 Richtextbox (renamed "Document")
- 1 toolstrip (File, Edit, Format, About)
- 1 Contextmenustrip ( Undo, Redo, Cut, Copy, Paste)
TO CREATE A DROPDOWNBUTTON FOLOW THESE INSTRUCTIONS:
1. Click the picture on the toolstrip, right click; convert to > dropdownbutton.
![Image]()
![Image]()
2. Right click the Blue(ish) picture you made in step 1; Display style > Text
![Image]()
3. Create 4 of those.
4. Rename them accordingly to the ones below.
![Image]()
TO CREATE A SEPARATOR FOLLOW THESE INSTRUCTIONS:
1. Put some text under the Dropdownbutton. (can be anything, even "poop head")
2. Right click it convert to> separator
![Image]()
- Under 'File'-
New
Open
Save
Exit
![Image]()
- Under 'Edit'-
Undo
Redo
Cut
Copy
Paste
![Image]()
-Under 'Format'-
Font
Font Color
Background Color
Date
time
Date/Time
![Image]()
-Under 'About'-
About
![Image]()
Ok now time for the rightclicking part, if you haven't veiw my tutorial, very easy steps @:
viewtopic.php?f=66&t=505
Blah....Blah....Blah.... And so on....
Once you make the contextmenustrip go to the code!
CODING TIME! wahooo;
Form1 Code only here :(
First Create a new form, if you don't know how please look below:
![Image]()
Add these to your new form:
- 2 buttons
- 1 label (" Do you wish to save this document? ")
![Image]()
Code For Form 2!!!
Form 3 can be anything explaining about the software, its restrictions, benifits, the coder, the company, etc.
All i did was put in " Made by Bjm0008 For use on http://www.codenstuff.com/ Only!" on a label.
GET CREATIVE, IF YOU MAKE A NOTEPAD LIKE MINE PM ME, SHOW ME WHAT YOU CAN DO!
Contains:
<3 forms>
Form1:
- 1 fontdialog
- 1 colordialog
- 1 Richtextbox (renamed "Document")
- 1 toolstrip (File, Edit, Format, About)
- 1 Contextmenustrip ( Undo, Redo, Cut, Copy, Paste)
TO CREATE A DROPDOWNBUTTON FOLOW THESE INSTRUCTIONS:
1. Click the picture on the toolstrip, right click; convert to > dropdownbutton.


2. Right click the Blue(ish) picture you made in step 1; Display style > Text

3. Create 4 of those.
4. Rename them accordingly to the ones below.

TO CREATE A SEPARATOR FOLLOW THESE INSTRUCTIONS:
1. Put some text under the Dropdownbutton. (can be anything, even "poop head")
2. Right click it convert to> separator

- Under 'File'-
New
Open
Save
Exit

- Under 'Edit'-
Undo
Redo
Cut
Copy
Paste

-Under 'Format'-
Font
Font Color
Background Color
Date
time
Date/Time

-Under 'About'-
About


Ok now time for the rightclicking part, if you haven't veiw my tutorial, very easy steps @:
viewtopic.php?f=66&t=505
Blah....Blah....Blah.... And so on....
Once you make the contextmenustrip go to the code!
CODING TIME! wahooo;
Form1 Code only here :(
Code: Select all
<Form 2>Public Class Form1
Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
If Document.Text = "" Then
MsgBox(" There Is Nothing Written, Use That :) ")
Else
Form2.Show()
End If
End Sub
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
Dim Open As New OpenFileDialog()
Dim myStreamReader As System.IO.StreamReader
Open.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*"
Open.CheckFileExists = True
Open.Title = "OpenFile"
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader = System.IO.File.OpenText(Open.FileName)
Document.Text = myStreamReader.ReadToEnd()
Catch ex As Exception
End Try
End Sub
Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
If Document.Text = "" Then
MsgBox(" Try Writing Something Before Saving. ")
Else
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*"
Save.CheckPathExists = True
Save.Title = "Save File"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(Document.Text)
myStreamWriter.Flush()
Catch ex As Exception
End Try
End If
End Sub
Private Sub ExitToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem1.Click
Me.Close()
End Sub
Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click
Document.Undo()
End Sub
Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click
Document.Redo()
End Sub
Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
Document.Cut()
End Sub
Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
Document.Copy()
End Sub
Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
Document.Paste()
End Sub
Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
FontDialog1.ShowDialog()
Document.Font = FontDialog1.Font
End Sub
Private Sub FontColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontColorToolStripMenuItem.Click
ColorDialog1.ShowDialog()
Document.ForeColor = ColorDialog1.Color
End Sub
Private Sub BackgroundColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColorToolStripMenuItem.Click
ColorDialog1.ShowDialog()
Document.BackColor = ColorDialog1.Color
End Sub
Private Sub TimeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeToolStripMenuItem.Click
Dim h As String = My.Computer.Clock.LocalTime.Hour
Dim m As String = My.Computer.Clock.LocalTime.Minute
If m < 10 Then m = "0" + m
If h > 12 Then h = h - 12
Dim time As String = h + ":" + m
If h > 12 Then time = time + " AM"
If h < 12 Then time = time + " PM"
Document.Text = Document.Text + time
End Sub
Private Sub DateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateToolStripMenuItem.Click
Dim d As String = My.Computer.Clock.LocalTime.Date
Document.Text = Document.Text + d
End Sub
Private Sub TimeDateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeDateToolStripMenuItem.Click
Dim h As String = My.Computer.Clock.LocalTime.Hour
Dim m As String = My.Computer.Clock.LocalTime.Minute
Dim d As String = My.Computer.Clock.LocalTime.Date
If m < 10 Then m = "0" + m
If h > 12 Then h = h - 12
Dim time As String = h + ":" + m
If h > 12 Then time = time + " AM"
If h < 12 Then time = time + " PM"
Document.Text = Document.Text + d + ", " + time
End Sub
Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
Form3.show()
End Sub
Private Sub UndoToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem1.Click
Document.Undo()
End Sub
Private Sub RedoToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem1.Click
Document.Redo()
End Sub
Private Sub CutToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem1.Click
Document.Cut()
End Sub
Private Sub CopyToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem1.Click
Document.Copy()
End Sub
Private Sub PasteToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem1.Click
Document.Paste()
End Sub
Private Sub ExitToolStripMenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem2.Click
Me.Close()
End Sub
End Class
First Create a new form, if you don't know how please look below:

Add these to your new form:
- 2 buttons
- 1 label (" Do you wish to save this document? ")

Code For Form 2!!!
Code: Select all
<Form 3>Public Class Form2
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Close()
Form1.Document.Clear()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Save As New SaveFileDialog()
Dim myStreamWriter As System.IO.StreamWriter
Save.Filter = "Text [*.txt*]|*.txt|All Files [*.*]|*.*"
Save.CheckPathExists = True
Save.Title = "Save File"
Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(Form1.Document.Text)
myStreamWriter.Flush()
Catch ex As Exception
End Try
Form1.Document.Clear()
Me.Close()
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Form1.Enabled = False
End Sub
Private Sub Form2_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Form1.Enabled = True
End Sub
End Class
Form 3 can be anything explaining about the software, its restrictions, benifits, the coder, the company, etc.
All i did was put in " Made by Bjm0008 For use on http://www.codenstuff.com/ Only!" on a label.
GET CREATIVE, IF YOU MAKE A NOTEPAD LIKE MINE PM ME, SHOW ME WHAT YOU CAN DO!
Last edited by bjm0008 on Thu Nov 12, 2009 10:59 pm, edited 5 times in total.
Hi
You need a bit of code to say
Form1.show
when you close the 2nd form
Hope this helps
Chris
You need a bit of code to say
Form1.show
when you close the 2nd form
Hope this helps
Chris
Chris,
Form1 is already visible when i close Form2.
I need a piece of code that says something like,
When Form2 closes, Form1 is enabled.
Form1 is already visible when i close Form2.
I need a piece of code that says something like,
When Form2 closes, Form1 is enabled.
I have just tried this with 2 forms
Form1 with a button on
with this code on the button
Me.Visible = False
Form2.Visible = True
So if you try it the other way round it will work
( form 2) me.visible=false
form1.visible = true
Form1 with a button on
with this code on the button
Me.Visible = False
Form2.Visible = True
So if you try it the other way round it will work
( form 2) me.visible=false
form1.visible = true
Acually, when I was working on another one of my projects I found the solution. I feel so stupid, I forgot all about this :P.
anywhere in form2's code put in
anywhere in form2's code put in
Code: Select all
Private Sub Form2_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Form1.Enabled = True
End Sub
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023