Check buttons c# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Check buttons c#

[RU]Работаем на с#,есть кнопки с названиями button1 button2 button3 ...,есть цикл for,нужно чтобы бралась кнопка оканчивающаяся цифрой равной значению переменной K. [ENG] Using C#. i have button1, button2, button3 ...., there is a for cycle, i need to work with each butto wich has ending of K! I need to check each button for (int K = 0; K<16; K++) { buttonK.Text... //some code }

3rd Dec 2017, 11:52 AM
Vladyslav Pecherytsya
Vladyslav Pecherytsya - avatar
1 Answer
+ 1
Have a look at the tag property. button.tag In the tag you can store an identifier so you don't have to mis use the buttonname for it. To check certain string conditions use endswith, startswith and contains https://www.dotnetperls.com/startswith
3rd Dec 2017, 12:08 PM
sneeze
sneeze - avatar