Bonjour à tous,
J'ai une table de reference à des comboBox, et j'ai six comboBox créées statiquement dans ma windows form.
J'aimerai remplir dynamiquement ma table référence avec mes 6 combobox.
en gros ne pas faire tbRef[0] = combo1; tbRef[1] = combo2; etc...
J'aimerais savoir si je pouvais récupérer les objet de type combobox par leurs nom. Faire quelque chose comme:
Merci d'avance de vos suggestions
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 private: System::Windows::Forms::ComboBox^ combo1; private: System::Windows::Forms::ComboBox^ combo2; private: System::Windows::Forms::ComboBox^ combo3; private: System::Windows::Forms::ComboBox^ combo4; private: System::Windows::Forms::ComboBox^ combo5; private: System::Windows::Forms::ComboBox^ combo6; private: System::Windows::Forms::ComboBox^ tempCombo; bool maForm::InitTablesReference() { tempCombo = gcnew ComboBox(); for(int numCombo=0; numCombo < MAX_CRNX; numCombo++) { tempCombo->Name = "combo"+Convert::ToString(numCombo+1); tableauRefComboBox[numCombo] = tempCombo; } return true; }
Kemanke
Partager