Salut, j'espère pouvoir t'apporter de la lumière à ton problème.
Voici un extrait de mon programme qui utilise listbox :
// -------------------
// Affichage Code Taux
// -------------------
private:
static String* tbl_Taux __gc[] = {S"001", S"003", S"005", S"007", S"008", S"011",
S"013", S"014", S"015", S"016", S"017", S"018", S"021", S"035", S"037", S"039"};
void Setup_Taux ()
{
type_Taux = new Label();
choixTaux = new ComboBox();
type_Taux->Location = Point(5, 200);
type_Taux->Size = System::Drawing::Size(100, 16);
type_Taux->Text = " Code Taux :";
type_Taux->TextAlign = ContentAlignment::MiddleRight;
choixTaux->DropDownWidth = 121;
choixTaux->Location = Point(110, 200);
choixTaux->Size = System::Drawing::Size(121, 21);
choixTaux->Text= Tbltemp[5];
for (int y=0; y<16; y++)
{
choixTaux->Items->Add((tbl_Taux[y]));
}
Controls->Add(type_Taux);
Controls->Add(choixTaux);
choixTaux->SelectedIndexChanged += new EventHandler(this,&CppForm::General_Clicked);
}
// ensuite la fonction General_Clicked
// -----------------------------------------------------------------------
// Si Selection OK general choisi, Rempli le tableau avec la valeur correspondante
// -----------------------------------------------------------------------
private:
static String* mem_rb3_rb4;
void General_Clicked(Object* pSender, EventArgs* pArgs)
{
// 1ere colone
if (pSender == rb1)
Tbltemp[0] = "C";
if (pSender == rb2)
Tbltemp[0] = "A";
if (pSender == choixTCN)
if (choixTCN->Text->Length > 0) Tbltemp[1] = choixTCN->SelectedItem->ToString();
if (pSender == choixDevise)
if (choixDevise->Text->Length > 0) Tbltemp[4] = choixDevise->SelectedItem->ToString();
if (pSender == choixTaux)
if (choixTaux->Text->Length > 0) Tbltemp[5] = choixTaux->SelectedItem->ToString();
etc....
Bon amusement...
Michel.
|