Hey guys!

I'm trying to change a textbox font size at run time with a track bar.

But, when I add to my code:

Textbox1.Font.Size = Trackbar1.Value

It says that Font.Size is a read only value. I haven't found any other way to do it.
There is a way to do this?


Thanks!

Recommended Answers

All 3 Replies

hi

use this code:

Me.TextBox1.Font = New Font("Arial", 20)

See if this helps.

Dim fontName As FontFamily = TextBox1.Font.FontFamily '// Get the Current Font Name used.
        TextBox1.Font = New Font(fontName, TrackBar1.Value) '// Set Font Name and Size.

It worked! Thanks guys!

Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.ValueChanged
        boxTextoInvertido.Font = New Font("Lucida Sans Unicode", TrackBar1.Value) '// Set Font Name and Size.
    End Sub

    Private Sub TrackBar2_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar2.ValueChanged
        boxTextoOriginal.Font = New Font("Lucida Sans Unicode", TrackBar2.Value) '// Set Font Name and Size.
    End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.