AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

StringGrid Zeile hinzufügen

Ein Thema von lucy · begonnen am 31. Okt 2022 · letzter Beitrag vom 15. Nov 2022
 
lucy

Registriert seit: 25. Okt 2017
83 Beiträge
 
Delphi XE7 Starter
 
#1

StringGrid Zeile hinzufügen

  Alt 31. Okt 2022, 08:30
Hallo,
habe hier im Forum schon gesucht, bin aber leider noch nicht fündig geworden.

Zurzeit wird die neue Zeile (im StringGrid) unten angehängt.
Wie kann man die aktuelle Zeile oben im StringGrid einfügen?
So das die älteren Datensätze nach unten geschoben werden.

Code:
procedure TForm1.ClientSocket1Read(Sender: TObject; Socket: TCustomWinSocket);
 var
     MSG, MSG1 : String;
             sl: TStrings;
    i, zaehler : Integer;
 begin
  MSG := Socket.ReceiveText;

  sl := TStringList.Create;
  sl.delimiter := ':';
  sl.DelimitedText := MSG;
   if sl.Strings[0] = 'test' then begin
    Memo1.Lines.Delete(0);
     end else begin
       MSG1 := sl.Strings[0] + ' | ' + sl.Strings[1] + ' | ' + sl.Strings[2] + ' | ' + sl.Strings[3] + ' | ' + sl.Strings[4];
       Memo3.Lines.Add('Status: ' + datetostr(date) + ' | ' + timetostr(time) + ' | ' + Socket.RemoteAddress + ' | ' + 'OnClientRead | ' + MSG1);
       
        i := StringGrid1.RowCount;
         StringGrid1.RowCount := i +1;

         StringGrid1.Cells [0, i] := '';
         StringGrid1.Cells [1, i] := '';
         StringGrid1.Cells [2, i] := IntToStr(zaehler);
         StringGrid1.Cells [3, i] := FormatDateTime ('dd:mm:yyyy', Now);
         StringGrid1.Cells [4, i] := FormatDateTime ('hh:nn:ss', Now);
         StringGrid1.Cells [5, i] := (sl.Strings[3]);

         StringGrid1.ColWidths[0] := 25;
         StringGrid1.ColWidths[1] := 70;
         StringGrid1.ColWidths[2] := 70;
         StringGrid1.ColWidths[3] := 70;
         StringGrid1.ColWidths[4] := 70;
         StringGrid1.ColWidths[5] := 125;
         StringGrid1.ColWidths[6] := 5000;

         StringGrid1.Cells [0,0] := '';
         StringGrid1.Cells [1,0] := '';
         StringGrid1.Cells [2,0] := 'TICKET';
         StringGrid1.Cells [3,0] := 'DATUM';
         StringGrid1.Cells [4,0] := 'ZEIT';
         StringGrid1.Cells [5,0] := 'ID';
         StringGrid1.Cells [6,0] := 'BESCHREIBUNG';
  end;
 end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:50 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz