Thread: About listbox
View Single Post
  #2 (permalink)  
Old April 29th, 2004, 06:17 AM
janeprime2001 janeprime2001 is offline
Authorized User
Join Date: Apr 2004
Location: pta, Gauteng, South Africa.
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Hi there!!

This is what I can come up with so far. You can use a string variable instead of a textbox.

I cannot find anything where you only change the color of the selected text but I will see if I can find anything else.

private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
    textBox1.Text = listBox1.Text;
    int count = 0;
    count = listBox1.SelectedIndex;
    if(count == listBox1.SelectedIndex)
    //if(listBox1.Text == textBox1.Text)
        listBox1.BackColor = Color.Beige;
        listBox1.ForeColor = Color.Blue;
        textBox1.ForeColor = listBox1.ForeColor;

Good Luck


Reply With Quote