Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.06.06;
Скачать: CL | DM;

Вниз

Ошибка   Найти похожие ветки 

 
jenbbond   (2002-05-25 10:12) [0]

n:=0;
for i:=0 to ComponentCount-1 do
if Components[i] is TBitBtnWithColor then
if n=1 then
TBitBtnWithColor(Components[i]).Color:=clRed;
if n=0 then
TBitBtnWithColor(Components[i]).Color:=clGreen;

Пытаюсь выполнить код , но при выполнении вылетает ошибка
Project1.exe raised exception class EListError whit message "List index out of bounds(18)".

Подскажите в чем проблема млжет быть!!!


 
Виктор Щербаков ©   (2002-05-25 10:24) [1]

Переменная i используется сразу после цикла:
TBitBtnWithColor(Components[i]).Color:=clGreen;
Её значение не определено.


 
Внук ©   (2002-05-25 11:02) [2]

Наверное, так:
n:=0;
for i:=0 to ComponentCount-1 do
if Components[i] is TBitBtnWithColor then
if n=1 then TBitBtnWithColor(Components[i]).Color:=clRed
else
if n=0 then TBitBtnWithColor(Components[i]).Color:=clGreen;



 
Anatoly Podgoretsky ©   (2002-05-25 11:18) [3]

Если это именно то, что он хочет сделать, то вместо IF
case N of
0: TBitBtnWithColor(Components[i]).Color:=clGreen;
1: TBitBtnWithColor(Components[i]).Color:=clRed;
end;



Страницы: 1 вся ветка

Текущий архив: 2002.06.06;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.01 c
1-17908
Andrey PR
2002-05-27 13:42
2002.06.06
Изменение ширины символа


8-18072
дикое Кенгуру
2002-01-20 08:19
2002.06.06
Можно пример, как использовать Direct Sound в Дельфи ? Загрузить, прослушать, поменять параметры.


1-17988
SergeyDon
2002-05-23 15:21
2002.06.06
Для волков делфи


14-18139
LP
2002-05-03 10:08
2002.06.06
Компонент TChart


14-18115
AndreyS
2002-04-29 18:40
2002.06.06
Общий вопрос