Bonsoir
Voici mon code qui ajoute dans une lixtBox des éléments de 3 tableaux de record
Ajout dans la ListBox
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 const t:array[0..106]of record ref : String; value : String;........... const t2:array[0..93]of record ref2 : String; value2 : String;........... const t3:array[0..93]of record ref2 : String; value2 : String;..............
Je recupere dans une autre listBox dans l'événement OnClick de la listBox
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
25
26 s:=edit1.Text; for i:=Low(t1) to High(t1) do begin r:=t1[i].ref; if pos(s,r)<>0 then begin ListBox5.Items.Add(r); end; end; for i:=Low(t2) to High(t2) do begin r2:=t2[i].ref2; if pos(s,r2)<>0 then begin ListBox5.Items.Add(r2); end; end; for i:=Low(t3) to High(t3) do begin r3:=t3[i].ref3; if pos(s,r3)<>0 then begin ListBox5.Items.Add(r3); end; end;
Le problème: Les valeurs que je recupere(value,value2 et value3) dans la ListBox5 ne correspondent pas aux valeurs dans mes 3 tableaux de constantes
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 procedure TForm1.ListBox5Click(Sender: TObject); begin if sender is TListBox Then begin with t3[(sender as TListBox).ItemIndex] do begin StatusBar5.SimpleText:='E° = '+ value3+'V'; end; with t2[(sender as TListBox).ItemIndex] do begin StatusBar5.SimpleText:='E° = '+ value2+'V'; end; with t[(sender as TListBox).ItemIndex] do begin StatusBar5.SimpleText:='E° = '+ value+'V'; end; end; end;
merci
Partager