Results 1 to 10 of 10

Hybrid View

  1. #1
    stevethehacker's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    USA bitch
    Posts
    416
    Reputation
    14
    Thanks
    51
    My Mood
    Bored

    [TUT]How to make a notepad program

    here is how to make a program with all the same functions of a regular notepad and you can add more if you want. First add a rich text box.
    Then add a menu strip
    Make the First option along the top File
    Make the next options in this order under file:
    New
    Open
    Save
    Exit
    Now the next option across the top is edit
    Under edit make the options in this order:
    Undo
    Redo
    Cut
    Copy
    Paste
    Clear
    Select all
    The next option across the top is format
    Make the Options under that:
    Color
    Font

    Copy & Paste
    Code:
    Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click
            RichTextBox1.Clear()
        End Sub
    
        Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
            Try
                Dim dlg As OpenFileDialog = New OpenFileDialog
                dlg.Title = "Open"
                dlg.Filter = "Rich Text Files (*.rtf)|*.rtf"
                If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                    RichTextBox1.LoadFile(dlg.FileName)
                End If
            Catch ex As Exception : End Try
        End Sub
    
        Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
            Try
                Dim dlg As SaveFileDialog = New SaveFileDialog
                dlg.Title = "Save"
                dlg.Filter = "Rich Text Files (*.rtf)|*.rtf"
                If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                    RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText)
                End If
            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
            Me.Close()
        End Sub
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
            Form1.Show()
        End Sub
    
        Private Sub UndoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UndoToolStripMenuItem.Click
            RichTextBox1.Undo()
        End Sub
    
        Private Sub RedoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RedoToolStripMenuItem.Click
            RichTextBox1.Redo()
        End Sub
    
        Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click
            RichTextBox1.Cut()
        End Sub
    
        Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click
            RichTextBox1.Copy()
        End Sub
    
        Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click
            RichTextBox1.Paste()
        End Sub
    
        Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click
            RichTextBox1.Clear()
        End Sub
    
        Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click
            RichTextBox1.SelectAll()
        End Sub
    
        Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
            Try
                Dim dlg As ColorDialog = New ColorDialog
                dlg.Color = RichTextBox1.ForeColor
                If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
                    RichTextBox1.ForeColor = dlg.Color
                End If
            Catch ex As Exception : End Try
        End Sub
    
        Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click
            Try
                Dim dlg As FontDialog = New FontDialog
                dlg.Font = RichTextBox1.Font
                If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
                    RichTextBox1.Font = dlg.Font
                End If
            Catch ex As Exception : End Try
        End Sub
    Press thanks
    Last edited by stevethehacker; 11-14-2009 at 03:14 PM.

  2. The Following User Says Thank You to stevethehacker For This Useful Post:

    CounterAct (11-14-2009)

  3. #2
    XGelite's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Enter text here
    Posts
    1,344
    Reputation
    12
    Thanks
    276
    well...you know.....this is like really really really basic..but w/e :P good for the choobs!

  4. #3
    Zoom's Avatar
    Join Date
    May 2009
    Gender
    male
    Location
    Your going on my 24/7 DDoS hit list.
    Posts
    8,552
    Reputation
    127
    Thanks
    5,970
    My Mood
    Happy
    Easy :]

    This is a very basic tutorial!
    -Rest in peace leechers-

    Your PM box is 100% full.

  5. #4
    Threadstarter
    Dual-Keyboard Member
    stevethehacker's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    USA bitch
    Posts
    416
    Reputation
    14
    Thanks
    51
    My Mood
    Bored
    it is supposed to be like notepad. This is exactly like notepad

  6. #5
    Pixie's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    Pixie wird wieder steigen.
    Posts
    1,884
    Reputation
    22
    Thanks
    229
    My Mood
    Fine
    Quote Originally Posted by stevethehacker View Post
    it is supposed to be like notepad. This is exactly like notepad
    This doesn't have a find text button
    I will looking for how to do that though

  7. #6
    ark1227's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    I should know this...
    Posts
    110
    Reputation
    10
    Thanks
    7
    My Mood
    Devilish
    i found one error while reading ur source code

    Code:
      Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
            Try
                Dim dlg As ColorDialog = New ColorDialog
                dlg.Color = RichTextBox1.ForeColor
                If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
                    RichTextBox1.ForeColor = dlg.Color
                End If
            Catch ex As Exception : End Try
        End Sub
    
        Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click
            Try
                Dim dlg As FontDialog = New FontDialog
                dlg.Font = RichTextBox1.Font
                If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then
                    RichTextBox1.Font = dlg.Font
                End If
            Catch ex As Exception : End Try
        End Sub
    u mixed up color and font so that wen u click font it will u give u options for color and vice versa

  8. #7
    edu_dudu's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    25
    Reputation
    10
    Thanks
    3
    I got an error when saving and loading file!

  9. #8
    ark1227's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Location
    I should know this...
    Posts
    110
    Reputation
    10
    Thanks
    7
    My Mood
    Devilish
    u prolly dint do everything that he told u to do because its wrking for me PERFECT rite now

  10. #9
    Pixipixel_'s Avatar
    Join Date
    Oct 2009
    Gender
    male
    Location
    VCExpress.exe || France :D
    Posts
    2,087
    Reputation
    27
    Thanks
    742
    My Mood
    Cool
    Nice tut
    Easy but usefull for beginners.

  11. #10
    edu_dudu's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    25
    Reputation
    10
    Thanks
    3
    It's because I didn't make the richtextbox, now it's working

Similar Threads

  1. *Tut* How To Make A Simple Notepad
    By u1111u in forum Programming Tutorials
    Replies: 2
    Last Post: 01-31-2010, 11:58 PM
  2. How to make a simple Program With Notepad
    By NuB_GhOsT in forum Programming Tutorials
    Replies: 9
    Last Post: 01-15-2010, 08:16 PM
  3. Replies: 13
    Last Post: 12-28-2009, 01:13 AM
  4. [TUT] How to make a annoying msn program!
    By Jerry12358 in forum Visual Basic Programming
    Replies: 3
    Last Post: 12-09-2009, 07:54 PM
  5. Replies: 6
    Last Post: 11-16-2009, 08:53 PM

Tags for this Thread