![]() |
OnTime Exepction ?
Hallo alle,
also habe ne Bösses Problem ich habe ne OnTime und wenn das ausgeführt wird will ich in einen ListView was auslesen.
Delphi-Quellcode:
doch es gibt da immer eine Exepction :wall: !!!
ID := ListView1.Items[Pos].SubItems[14];
Mit ne Button --> ButtonClick geht diese Zeile warum aber im OnTime nicht ? :gruebel: |
Re: OnTime Exepction ?
welche exception?
was ist pos, wo und auf was wird das gesetzt? |
Re: OnTime Exepction ?
Also Pos ist ne Integer und beim aufruf der Funktion 0 also ich will damit den 1 Eintrag aus meinen ListView.
Die Exception "Zugrief auf Adressspeicher Sowieso blabla bla (eben eine Adresse)". Was man eben von Windows kennt. |
Re: OnTime Exepction ?
dann greifst du wohl auf eine postion zu, die nicht definiert ist, und deshalb gibts die AV
entweder ist Pos nicht innerhalb deiner Liste, oder der SubItem Index mit 14 ist zu hoch (zb. du hast keine 15 subelemente) aber ohne mehr code kann man natürlich nur munter drauf los raten |
Re: OnTime Exepction ?
Zitat:
|
Re: OnTime Exepction ?
Das war ne vergleich :wink: !
Soweit wie ich das gezählt habe sind das 15 :gruebel: .
Delphi-Quellcode:
var
tpcolumn: TListColumn; begin .... ListView1.RowSelect:= TRUE; ListView1.MultiSelect:= TRUE; ListView1.showcolumnheaders := TRUE; ListView1.ReadOnly := TRUE; ListView1.ViewStyle := vsReport; ListView1.IconOptions.Arrangement := iaTop; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := 'Haupt '; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '1'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '2'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '3'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '4'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '5'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '6'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '7'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '8'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '9'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '10'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '11'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '12'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '13'; tpcolumn.width := 40; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '14'; tpcolumn.width := 60; tpcolumn := ListView1.Columns.Add; tpcolumn.Caption := '15'; tpcolumn.width := 60; .... So und damit kein Fusch passiert kommt noch vor der abfrage
Delphi-Quellcode:
Und da ich den Eintrag sehe und er da vorbeikommt wundert mich das, das er da Abschmiert :gruebel: .
if ListView1.Items.Count = 0 then
begin ShowMessage('Bitte erstmal was in die Liste eintragen!'); Exit; end; |
Re: OnTime Exepction ?
Zitat:
|
Re: OnTime Exepction ?
dann zeig noch den code her, wo du das machst ID := ListView1.Items[Pos].SubItems[14]; (also das drüber)
[edit]bzw. kontrolliere, das pos auch wirklich im bereich ist |
Re: OnTime Exepction ?
Erstmal Windows ist doch immer Schuld :tongue: .
Ok hier so sieht das ganze aus.
Delphi-Quellcode:
:duck:
procedure TfrmBot.Timer1Timer(Sender: TObject);
var ID: String; Href: String; begin Timer1.Enabled := False; if LoginStatus then begin ID := ListView1.Items[Pos].SubItems[14]; Href := Form1.WebBrowser1.OleObject. Document.Frames.item('main'). Document.location.href; if Href <> 'http://www.google.de/search.php?id=' + ID + '&suche=place' then begin exit; end; Form1.WebBrowser1.OleObject.Document.Frames.item('main'). Document.Forms.item('units').Elements.item('x').value := ListView1.Items[Pos].Caption; Form1.WebBrowser1.OleObject.Document.Frames.item('main'). Document.Forms.item('units').Elements.item('y').value := ListView1.Items[Pos].SubItems[0]; end; end; |
Re: OnTime Exepction ?
und WO wird pos auf einen wert gesetzt?
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:18 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-2025 by Thomas Breitkreuz