delphi4arab منتديات دلفي للعرب
عدم تكرار الاسماء في ليست فيوListView - نسخة قابلة للطباعة

+- delphi4arab منتديات دلفي للعرب (https://delphi4arab.net/forum)
+-- قسم : منتديات دلفي للعرب التعليمية (https://delphi4arab.net/forum/forumdisplay.php?fid=3)
+--- قسم : سؤال و جواب حول دلفي (https://delphi4arab.net/forum/forumdisplay.php?fid=15)
+--- الموضوع : عدم تكرار الاسماء في ليست فيوListView (/showthread.php?tid=4318)



عدم تكرار الاسماء في ليست فيوListView - M_Mori2010 - 29-06-2012

السلآم عليكم ورحمة الله وبركاته
كيف فحص الاسم المدخل في Edit عند الضغط على Btn اذا كان موجود في ال List View قبل اضافته وجزاكم الله كل خير


عدم تكرار الاسماء في ليست فيوListView - format82 - 29-06-2012

هذا الكود يعمل مع listbox عدل عليها لكي يعمل مع List View


كود :
var x:integer; begin for x:=0 to listbox1.Count-1 do if listbox1.Items.Strings[x]=edit1.Text then listbox1.Selected[x]:=true;



عدم تكرار الاسماء في ليست فيوListView - Agmcz - 29-06-2012

وعليكم السلام
PHP كود :
function ListViewDuplicates(const LV: TListView; const Check: string): Boolean;
var
  
i: Integer;
begin
  Result 
:= False;
  for 
i := LV.Items.Count - 1 downto 0 do
  
begin
    
if LV.Items[i].Caption = Check then
    begin
      Result 
:= False;
      Break;
    
end
    
else
      
Result := True;
  
end;
end;

Button:

var
  
Li: TListItem;
begin
  
if ListViewDuplicates(ListView1, Edit1.Text) then
  begin
    Li 
:= ListView1.Items.Add;
    
Li.Caption := Edit1.Text;
  
end;
end; 



عدم تكرار الاسماء في ليست فيوListView - S.FATEH - 11-07-2012

ghost-dz كتب :وعليكم السلام
PHP كود :
function ListViewDuplicates(const LV: TListView; const Check: string): Boolean;
var
  
i: Integer;
begin
  Result 
:= False;
  for 
i := LV.Items.Count - 1 downto 0 do
  
begin
    
if LV.Items[i].Caption = Check then
    begin
      Result 
:= False;
      Break;
    
end
    
else
      
Result := True;
  
end;
end;
end; 

لا داعي لتحديد result بعد break الافضل:

كود :
function ListViewDuplicates(const LV: TListView; const Check: string): Boolean; var i: Integer; begin Result := True; for i := LV.Items.Count - 1 downto 0 do begin if LV.Items[i].Caption = Check then begin Result := False; Break; end end; end;

السلام عليكم