Results 1 to 2 of 2

Thread: keeping rtb's selection when selecting a combobox

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2002
    Posts
    210

    keeping rtb's selection when selecting a combobox

    i have a richtextbox on a tab and a combo box on the same tab. the combo box contains whole numbers that, when selected, changes the font size of the selection from the rtb equivilant to the number selected.

    i have a small problem though. clicking on the combo box removes the selection from the rtb. is there any way to go around it?

    thanks.

  2. #2
    Addicted Member Hole-In-One's Avatar
    Join Date
    Mar 2003
    Location
    Minnesota
    Posts
    195
    Try this, it works fine for me:

    Code:
     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim sz As Single
            For sz = 6 To 24
                ComboBox1.Items.Add(sz)
            Next
        End Sub
    
    
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
            Dim i As Single = Convert.ToSingle(ComboBox1.SelectedItem)
            RichTextBox1.Font = New Font(New FontFamily("Arial"), i)
        End Sub
    Last edited by Hole-In-One; Mar 9th, 2004 at 08:43 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width