In a situation like this one, I would recommand using a loop.
You would have an array of controls and loop through them.
for (int i = 0, count = StrToInt(EditParcela->Text); i != count; ++i)
{
edit[i]->ParentColor = false;
edit[i]->ReadOnly = false;
}
What is suspicious in your code is that you do nothing for remainding edits... I would thinkg that they should be set to
true
.
Thus in above code, the loop woul be something like:
for (int i = 0, used = StrToInt(EditParcela->Text), count = 7 ; i != count; ++i)
{
bool editInUse = i < used;
edit[i]->ParentColor = !editInUse;
edit[i]->ReadOnly = !editInUse;
}