我在Delphi 7中有一個字符串網格,其中有0..N行。如果用戶單擊列表框中的任意數字,則列表框中的數字爲0..N ,則應在字符串網格上選擇該行數。以編程方式突出顯示一個stringgrid行
,所以我有這個
MystringGrid.Col :=0;
MystringGrid.Row :=Listbox.itemindex;
MystringGrid.Selection:=TGridRect(Rect(0,1 ,1 ,1));
MystringGrid.SetFocus;
這將很好地選擇對電網的行(高亮顯示),但問題是,如果
listbox.itemindex=MystringGrid.rowcount;
那個時候我得到
Grid Index out of range error
as grids.pas
if (ACol < 0) or (ARow < 0) or (ACol >= ColCount) or (ARow >= RowCount) then
InvalidOp(SIndexOutOfRange)
(ARow >= RowCount)
是真的如此錯誤
如何選擇最後一排?
關閉一個或柵欄柱的錯誤,因爲我們給他們打電話,是PEBKAC問題。鍵盤和椅子之間存在問題。 I.E.,你的人腦是一個人而不是電腦。 – 2013-04-06 13:14:00