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: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69:
| procedure TForm1.edt1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if Key = VK_Return then edt1Change(Self); end;
procedure TForm1.edt1Change(Sender: TObject); var feldname : string; suchwort : string; DS : TDataset; begin if (Length(edt1.text) >2) or (sender <> edt1) then begin feldname := cbb1.text; suchwort := Edt1.Text; DS := DBGrid.DataSource.DataSet; DS.active := FALSE; DS.Filter := Feldname + ' = '#39 + SuchWort + '*'#39; DS.Filtered := TRUE; DS.active := TRUE; if DS.Recordcount = 0 then begin Information(suchwort + ' nicht gefunden'); end else begin SuchRoutine(DS); end; end; end;
procedure Fehler(s: string); begin messageDlg(s, mtError, [mbOk], 0); end;
procedure Information(s: string); begin messageDlg(s, mtInformation, [mbOk], 0); end;
procedure Hilfe(s: string); begin messageDlg(s, mtInformation, [mbHelp], 1); end;
procedure Warnung(s: string); begin messageDlg(s, mtWarning, [mbOk], 0); end;
function Bestaetigung(s: string): Boolean; begin Bestaetigung := (messageDlg(s, mtConfirmation, [mbYes, mbNo], 0) = mrYes); end;
procedure TForm1.Suchroutine(DS : TDataset); var Erg : boolean; begin Erg := DS.FindFirst; DBGrid1.SelectedField := DS.FieldByName(Feldname); while Erg do begin if Bestaetigung('Weitersuchen?') then Erg := DS.FindNext; end; end; |