dbgrid çift kayıt

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
doktoraltun
Üye
Mesajlar: 73
Kayıt: 06 Oca 2012 06:56

Re: dbgrid çift kayıt

Mesaj gönderen doktoraltun »

Şöyle bir Çözüm buldum belki birilerinin işine yarar diye yazıyorum

Kod: Tümünü seç

var
i,count:integer;
thisstring,laststring:string;
begin

  listbox3.Clear;
  ListBox1.Sorted := true;

  count := 1;

  lastString := '';

  for i:=0 to ListBox1.Items.Count-1 do begin
    thisString := ListBox1.Items[i];

    if thisString = lastString then
      count := count + 1
    else
      if lastString <> '' then begin
         ListBox3.Items.Add('['+IntToStr(count)+ ']-' +lastString);
         count := 1;
      end;
      lastString := thisString;
  end;

  if count > 0 then
    ListBox3.Items.Add('['+IntToStr(count)+ ']-' +lastString);
bu kodda listbox1deki çift kayıtları listbox3 içerisine kaç sefer tekrarlandıysa tekrarı ile birlikte yazıyor saygılar.
Cevapla