Enable and disable multiple buttons in Visual C++ -


i'm trying enable , disable multiple button years 2016 2005, named but2016 but2005, in c++ program didn't work:

when assigned variable within name, like: but+"&i"->enable = false;

it appeared error undeclared. and, when tried use indirect variable, didn't work, like:

radiobutton^ = (gcnew system::windows::forms::radiobutton());  (i = 2016; > 2004; i--) {   but->name = "but" + (i);   textbox1->text = but->name->tostring();   but->enabled = false; } 

how solve issue?

you can't combine strings make new variable names. however, should possible enter buttons container of sort , iterate on using loop.

below pseudocode. please bear in mind not written in c++, should possible:

map buttons = new hashmap(); buttons.add(2005, but2005); buttons.add(2006, but2006); ... // add buttons  (integer in buttons) {     if (i >= 2005 && <= 2016) {         buttons.get(i).disable();     } } 

Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -