Pages

Subscribe:

Ads 468x60px

♪ ♥ Get Paid Daily - The Best Sites PTC ♥ ♪
DonkeyMails.com: No Minimum Payout
AyuWage Services - Get Paid to Visits Sites and Complete Surveys

Rabu, 20 Februari 2013

Membuat Notepad Dengan VB.Net

Tutorial vb.net berikut ini adalah belajar cara 
membuat Notepad sederhana dengan program vb.net seperti notepad buatan microsoft, yah namanya juga sederhana pasti tidak sesempurna aslinya, paling tidak kita tahu bagaimana cara membuatnya..


Notepad sederhana ini menggunakan beberapa tool yang terdapat di vb.net yaitu MenuStrip, ContextMenuStrip serta RichtTextBox. 



tutorial vb.net cara membuat Notepad sederhana dengan program vb.net :




    1. Langsung saja buka Microsoft Visual Basic 2010 anda.
    2. Muncul “Form1”, masukkan MenuStrip, ContextMenuStrip serta RichtTextBoxyang terdapat di ToolBox dengan cara double klik ToolBox yang dipilih
    3. Klik MenuStrip1 dan ganti menu seperti di bawah ini dengan mengklik “Type Here” pda MenuStrip1
    4. Klik ContextMenuStrip dan ganti menu seperti di bawah ini dengan mengklik “Type Here” pada ContextMenuStrip
    5. Ubah Propertiesnya seperti ini :
      Nama ControlPropertiesNilai
      Form1TextNotepad
      MaximizeboxFalse
      7. Setelah itu masukkan kode berikut ini :
      Public Class Form1
      Private Sub BaruToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BaruToolStripMenuItem.Click
      RichTextBox1.Text = “”
      End Sub

      Private Sub BukaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BukaToolStripMenuItem.Click
      Dim kotak_dialog As OpenFileDialog = New OpenFileDialog
      kotak_dialog.Filter = “Text (*.txt)|*.txt”
      kotak_dialog.ShowDialog()
      Dim FileText As String = My.Computer.FileSystem.ReadAllText(kotak_dialog.FileName)
      RichTextBox1.Text = FileText
      End Sub

      Private Sub SimpanToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpanToolStripMenuItem.Click
      Dim kotak_dialog As SaveFileDialog = New SaveFileDialog
      kotak_dialog.Filter = “Mainkan Musiknya (*.txt)|*.txt”
      kotak_dialog.ShowDialog()
      My.Computer.FileSystem.WriteAllText(“” & kotak_dialog.FileName & “”, RichTextBox1.Text, False)
      End Sub

      Private Sub RegulerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RegulerToolStripMenuItem.Click
      RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Regular)
      End Sub

      Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click
      Dim color_dialog As ColorDialog = New ColorDialog
      color_dialog.ShowDialog()
      RichTextBox1.SelectionColor = color_dialog.Color
      End Sub

      Private Sub RichTextBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RichTextBox1.MouseDown
      If (e.Button = Windows.Forms.MouseButtons.Right) Then
      ContextMenuStrip1.Show(RichTextBox1, e.Location)
      End If
      End Sub

      Private Sub RichTextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RichTextBox1.TextChanged

      End Sub

      Private Sub BoldToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BoldToolStripMenuItem.Click
      RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Bold)
      End Sub

      Private Sub ItalicToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ItalicToolStripMenuItem.Click
      RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Italic)
      End Sub

      Private Sub StrikeoutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StrikeoutToolStripMenuItem.Click
      RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Strikeout)
      End Sub

      Private Sub UnderlineToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnderlineToolStripMenuItem.Click
      RichTextBox1.SelectionFont = New Font(RichTextBox1.SelectionFont, FontStyle.Underline)
      End Sub

      Private Sub MenuStrip1_ItemClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolStripItemClickedEventArgs) Handles MenuStrip1.ItemClicked

      End Sub
      End Class

      8.  Setelah itu klik “Start Debugging (F5)
      9.  Maka akan tampil Notepad sederhana seperti tampilan berikut ini :
      ~ Klik File maka akan tampil menu: Baru, Buka, Simpan

      ~ Ketikan Kata atau tulisan di dalam textbox dan blok tulisan tersebut, setelah itu klik kanan maka akan ada pilihan Regular, Bold, Italic, Strikeout, Underline dan juga color.

0 komentar:

Poskan Komentar

Please Give Your Feedback Or Message.
Thank You!!?

♪ ♥ Ma liste de blogs ♥ ♪

♪ ♥ Please Votes! Thanks. ♪ ♥
×