Mendapatkan Text pe-baris pada Rich Textbox pada Vb.net 2008

Posted: January 9, 2012 in Uncategorized

Beberapa waktu yang lalu saya mendapatkan small task untuk membuat applikasi kecil yang fungsinya mendapatkan text perbaris dari rich textbox dengan beberapa format, mungkin applikasi ini dapat membantu teman2 yang membutuhkan.

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
format.Items.Add(“‘Petik’”)
format.Items.Add(“Titik koma ;”)
format.SelectedIndex = 0
End Sub

Private Sub Proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Proses.Click
If format.SelectedIndex = -1 Then Exit Sub
If RichTextBox1.Text.Trim = “” Then Exit Sub

RichTextBox2.Text = “”

If format.SelectedIndex = 0 Then
For Each line As String In RichTextBox1.Lines
RichTextBox2.Text += “‘” & Trim(line) & “‘,” & vbCrLf
Next line
ElseIf format.SelectedIndex = 1 Then
For Each line As String In RichTextBox1.Lines
RichTextBox2.Text += Trim(line) & “;”
Next line
End If
End Sub

Private Sub kosong_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kosong.Click
RichTextBox1.Clear()
RichTextBox2.Clear()
End Sub
End Class

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s