VB.NET Text Font Style And Color

VB.NET - How To Change Text Font Style And Color In Visual Basic.NET


In This VB.NET Tutorial We Will See How To Change A Label Font Style And Color Using Radio Buttons In Visual Basic .NET Programming Language .


Project Source Code:

Public Class Style_Text

    Private Sub RDB_REGULAR_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_REGULAR.CheckedChanged

        Label1.Font = New Font(Label1.Font.FontFamily, Label1.Font.Size, FontStyle.Regular)

    End Sub

    Private Sub RDB_BOLD_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_BOLD.CheckedChanged

        Label1.Font = New Font(Label1.Font.FontFamily, Label1.Font.Size, FontStyle.Bold)

    End Sub

    Private Sub RDB_UNDERLINE_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_UNDERLINE.CheckedChanged

        Label1.Font = New Font(Label1.Font.FontFamily, Label1.Font.Size, FontStyle.Underline)

    End Sub

    Private Sub RadioButton4_CheckedChanged(sender As Object, e As EventArgs) Handles RadioButton4.CheckedChanged

        Label1.Font = New Font(Label1.Font.FontFamily, Label1.Font.Size, FontStyle.Italic)

    End Sub

    Private Sub RDB_STRIKEOUT_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_STRIKEOUT.CheckedChanged

        Label1.Font = New Font(Label1.Font.FontFamily, Label1.Font.Size, FontStyle.Strikeout)

    End Sub

    Private Sub RDB_BLACK_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_BLACK.CheckedChanged

        Label1.ForeColor = Color.Black

    End Sub

    Private Sub RDB_RED_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_RED.CheckedChanged

        Label1.ForeColor = Color.Red

    End Sub

    Private Sub RDB_GREEN_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_GREEN.CheckedChanged

        Label1.ForeColor = Color.Green

    End Sub

    Private Sub RDB_BLUE_CheckedChanged(sender As Object, e As EventArgs) Handles RDB_BLUE.CheckedChanged

        Label1.ForeColor = Color.Blue

    End Sub
End Class

///////////////OUTPUT:

vb.net text font style and color




Share this

Related Posts

Previous
Next Post »