![]() |
|
filter في listbox - نسخة قابلة للطباعة +- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum) +-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3) +--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15) +--- الموضوع : filter في listbox (/showthread.php?tid=12171) |
filter في listbox - Team dz - 01-01-2023 السلام عليكم اريد عملية فلترة لي ليست بوكس عندي 2 listbox عندي في ليست بوكس 1 يحتوي علا A B C وليست بوكس 2 فارغ عند اختيار A يههر في ليست بوكس 2 ahmed kamel anis وعند اختيار B يمسح ليست بوكس 2 ويضهر لي fatah said sami عند اختيار B يمسح ليست بوكس 2 ويضهر لي aymen mohamed khaled جربت هذا الكود ولم ينجح معي كود : begin
ListBox2.Clear;
if ListBox1.Items[ListBox1.ItemIndex ]='A' then
ListBox2.Items.Add(' ahmed ');
ListBox2.Items.Add(' kamel ') ;
ListBox2.Items.Add(' anis ') ;
// ListBox2.Clear;
if ListBox1.Items[ListBox1.ItemIndex ]='B' then
ListBox2.Clear;
ListBox2.Items.Add(' fatah ');
ListBox2.Items.Add(' said ') ;
ListBox2.Items.Add(' sami ') ;
ListBox2.Clear;
if ListBox1.Items[ListBox1.ItemIndex ]='C' then
ListBox2.Items.Add(' aymen ');
ListBox2.Items.Add(' mohamed ') ;
ListBox2.Items.Add(' khaled ') ;
end;RE: filter في listbox - larbiparadox - 01-01-2023 كود : procedure TForm1.ListBox1Click(Sender: TObject);
begin
ListBox2.Clear;
if ListBox1.Items[ListBox1.ItemIndex ]='A' then begin
ListBox2.Items.Add(' ahmed ');
ListBox2.Items.Add(' kamel ') ;
ListBox2.Items.Add(' anis ') ;
end;
if ListBox1.Items[ListBox1.ItemIndex ]='B' then begin
ListBox2.Items.Add(' fatah ');
ListBox2.Items.Add(' said ') ;
ListBox2.Items.Add(' sami ') ;
end;
if ListBox1.Items[ListBox1.ItemIndex ]='C' then begin
ListBox2.Items.Add(' aymen ');
ListBox2.Items.Add(' mohamed ') ;
ListBox2.Items.Add(' khaled ') ;
end;
end;RE: filter في listbox - Team dz - 01-01-2023 كود : begin
ListBox2.Clear;
if ListBox1.Items[ListBox1.ItemIndex ]='A' then
ListBox2.Items.Add(' ahmed ');
ListBox2.Items.Add(' kamel ') ;
ListBox2.Items.Add(' anis ') ;
// ListBox2.Clear;
if ListBox1.Items[ListBox1.ItemIndex ]='B' then
ListBox2.Clear;
ListBox2.Items.Add(' fatah ');
ListBox2.Items.Add(' said ') ;
ListBox2.Items.Add(' sami ') ;
ListBox2.Clear;
if ListBox1.Items[ListBox1.ItemIndex ]='C' then
ListBox2.Items.Add(' aymen ');
ListBox2.Items.Add(' mohamed ') ;
ListBox2.Items.Add(' khaled ') ;
end;شكرا لك اخي الكريم الكود يعمل جيدا لكن ارت ان اطور الكود في وضع 4 ليست بوكس وجدت مشكلة عندما اخذت الكود واردت تطبيقه علا ليست 3 وليست 4 لا تضهر نتائج بالطبع الكود اخذته وغيرت فيه القيم صورة للتوضيح وارفقت كود سورس للتعديل عليه وشكرا لكم RE: filter في listbox - Agmcz - 02-01-2023 السلام عليكم المشكل في الفراغات التي يتم إضافتها مع الأسماء لهذا المقارنة لا تنجح. يمكنك حذف الفراغات أو إستعمال Trim كود : if ListBox2.Items[ListBox2.ItemIndex].Trim = 'kamel' thenRE: filter في listbox - Team dz - 02-01-2023 شكرا لك هذا هو المطلوب اخي بركا الله فيك مشكل في فرغات |