G
G
goldolov_na2019-04-27 15:11:40
C++ / C#
goldolov_na, 2019-04-27 15:11:40

How to record all changes in combobox in richtextbox?

there is a richtextbox and a combobox in the combobox there are 3 values ​​and when you click on each one, the corresponding text should be displayed: "You have selected 1 value, etc."
here is the code

private void richTextBox1_TextChanged(object sender, EventArgs e)
{
    if(comboBox1.SelectedItem == comboBox1.Items[0])
    {
        richTextBox1.Text += "Вы выбрали размер по умолчанию!" + Environment.NewLine;
    }         
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
goldolov_na, 2019-04-27
@goldolov_na

should have been added to the combobox, not the richtextbox

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBox1.SelectedItem == comboBox1.Items[0])
            {
                richTextBox1.Text += "Вы выбрали размер по умолчанию!" + Environment.NewLine;
            }
        }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question