Add listbox items with different colors using a checkbox C#

Viewed 83

I am adding items to a listbox via a textbox, and I would like to know how change the color of the listbox item that is added from the textbox when the checkbox is checked. So when I check the checkbox, the color in the textbox turns red and when I click the button to send the textbox to the listbox, the listbox item turns red. If I don't check the checkbox then the text color is black, so if the first one that is added and red, then I add to black ones, then in the listbox I need to see one red, and one black.

Thanks,

private void addEventButton_Click(object sender, EventArgs e)
    {


        // Adds events to listbox. 
       if (this.titleTextBox.Text != "")
        {
            listBox1.Items.Add(this.titleTextBox.Text); 
            listBox2.Items.Add(this.titleTextBox.Text);
            this.titleTextBox.Focus();
            this.titleTextBox.Clear();
1 Answers
Related