✅ Text box color changing
how to change color for every text box which contain text "Red" ?
48 Replies
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
there is many text box (300), after user press "generate" all text box values changing
I want to make textbox with the bigest value red
we're asking for the type name of the textbox
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Winform
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Yes
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
TextBox Класс (System.Windows.Forms)
Предоставляет элемент управления "текстовое поле" Windows.
BackColor?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I think yes
Ehh....
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I mean , how to change bg for every textbox which contain "red"
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I know but maybe my teacher didn't hear about this
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
.
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
foreach (Control control in this.Controls)
{
if (control is TextBox textBox && textBox.Text.Contains("Red"))
{
textBox.ForeColor = Color.Red;
}
}
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Do you mean something like this?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Oops, sorry
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
it would be too wild
±
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
I understand
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
No , because it's contain some value
For example red
Just example
You may use .HasChildren property
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
What's wrong with recursion?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
All task sounds like
Find the largest number for num%8==0 and make textbox which contains it Red
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
But how can I know that later won't be generated textbox which contain larger number?
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Every time you make me textbox, add it to list
Then you can just loop through list
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Yes
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Hm
I can use value like id
To find textbox and change color
Unknown User•13mo ago
Message Not Public
Sign In & Join Server To View
Good luck
Thank you all