TextBox ile Visual Basic'te yazı işlemlerini öğreneceğiz.
Forma eklemeniz gerekenler;
1 tane textbox
9 tane button
1 tane fontdiyalog
1 tane colordialog
Kodlama:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.SelectionLength > 0 Then TextBox1.Cut() Else MsgBox("Seçili Alan Yok!") End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox1.SelectionLength > 0 Then TextBox1.Copy() Else MsgBox("Alan boş!") End If End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click TextBox1.Paste() End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click TextBox1.Undo() TextBox1.Font = New Font(Font, FontStyle.Regular) TextBox1.ForeColor=color.Black End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click If FontDialog1.ShowDialog = DialogResult.OK Then TextBox1.Font = FontDialog1.Font End If End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click If ColorDialog1.ShowDialog = DialogResult.OK Then TextBox1.ForeColor = ColorDialog1.Color End If End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click TextBox1.Font = New Font(Font, FontStyle.Bold) End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click TextBox1.Font = New Font(Font, FontStyle.Italic) End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click TextBox1.Font = New Font(Font, FontStyle.Underline) End Sub
ads
Hiç yorum yok: