I can not change the font color of a textbox that is inside a flowLayoutPanel

0

I do not know where the error is but I do not change the text color when I run the program.

The textbox is created at runtime.

    for (int i = 0; i < listaMIX.Length; i++)
    { 

    TextBox _textbox = new TextBox();               
            _textbox.Text = listaMIX[i].ToString();
            _textbox.TextAlign = HorizontalAlignment.Center;
            _textbox.Width = 60;
            _textbox.Height = 30;

            if (System.Text.RegularExpressions.Regex.IsMatch(_textbox.Text, "[S]"))
            {
                _textbox.BackColor = Color.Red;
                _textbox.ForeColor = Color.White;
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(_textbox.Text, "[E]"))
            {
                _textbox.BackColor = Color.LightBlue;
                _textbox.ForeColor = Color.Blue;
            }

                flowLayoutPanel1.Controls.Add(_textbox);
    }

    Form2 form2 = new Form2(this);
    form2.Controls.Add(flowLayoutPanel1);
    
asked by Skakimat 30.10.2018 в 12:47
source

0 answers