Autor Beitrag
Lucky
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 84

XP
Delphi 7
BeitragVerfasst: Do 27.07.06 07:37 
hallo,
ich hab da mal wieder ein kleines Problem, ich habe folgenden Quellcode, mitdem ich ein JvgStringgrid durchsuche, aber er findet einfach in der "Beschreibung"-Spalte nichts. Könnt ihr mir vielleicht sagen wo mein Fehler liegt. Vielen Dank schon mal im Voraus.

ausblenden Delphi-Quelltext
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:
27:
28:
29:
30:
procedure TForm1.Button1Click(Sender: TObject);
var suchwort:String;
  begin
      seekrecord(JvgStringGrid1,[2],[suchwort]);
     ShowMessage(suchwort);
  end;

function TForm1.seekrecord(Grid:Tjvgstringgrid; ColOrder: array of Integer; Strlist:array of String):Boolean;
var
  i,j:integer;
    begin
      result:=false;
      for I:=0 to grid.RowCount -1 do
        begin
          for j:=low(colorder) to high(colorder) do
            begin
              if(Grid.Cells[ColOrder[j],i]=Strlist[j]) then
                result:=true
              else
                result:=false;
              if result=false then break;
            end;
             if result=true then break;
            end;

          if result = true then
            Grid.Row:=i
          else
            ShowMessage('Datensatz nicht gefunden');
        end;


und so sieht mein jvgstringgrid aus:

nr Name Beschreibung
1 interface FastEthernet0/1 description EDVTEST|IP-Adresse|Port
2 interface FastEthernet0/2 description EDVTEST1|IP-Adresse|Port
3 ... ...
4
5
...
hat sich erledigt, kapier den Code net ganz :cry:
Moderiert von user profile iconjasocul: Delphi-Tags hinzugefügt


Zuletzt bearbeitet von Lucky am Do 27.07.06 14:00, insgesamt 1-mal bearbeitet
wdbee
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 628
Erhaltene Danke: 1



BeitragVerfasst: Do 27.07.06 09:30 
Warum verwendest du den Index j für Stringlist?
Wenn ich das richtig sehe, dann ist j = 2, aber in Stringlist wird nur ein String übergeben, also hat der nicht den Index 2.