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

Вниз

List View - не добавляются элементы   Найти похожие ветки 

 
Urvin   (2006-06-22 19:16) [0]

почему-то при работе следующего кода вылетает ошибка:
procedure TfrmMAin.Button2Click(Sender: TObject);
begin
 lvClients.Items.Add.Caption:="Fsdtuu";
end;


Project ... exception class EStringList Error with Message "list index out of bounds (7)"
Process stopped..

в чем причина?


 
EvS ©   (2006-06-22 19:32) [1]

Справку читать не пробовал?
This example requires only a blank form.  All other objects: TListView, TListColumns, TListItems, are created dynamically. You must add comctrls to the uses clause of the unit file.

procedure TForm1.FormCreate(Sender: TObject);

const
 Names: array[0..5, 0..1] of string = (
   ("Rubble", "Barney"),
   ("Michael", "Johnson"),
   ("Bunny", "Bugs"),
   ("Silver", "HiHo"),
   ("Simpson", "Bart"),
   ("Squirrel", "Rocky")
   );

var
 I: Integer;
 NewColumn: TListColumn;
 ListItem: TListItem;
 ListView: TListView;
begin
 ListView := TListView.Create(Self);
 with ListView do
 begin
   Parent := Self;
   Align := alClient;

   ViewStyle := vsReport;

   NewColumn := Columns.Add;
   NewColumn.Caption := "Last";
   NewColumn := Columns.Add;
   NewColumn.Caption := "First";

   for I := Low(Names) to High(Names) do
   begin
     ListItem := Items.Add;
     ListItem.Caption := Names[I][0];

     ListItem.SubItems.Add(Names[I][1]);
   end;
 end;
end;


 
Urvin   (2006-06-22 19:44) [2]

справку читать пробовал. причем по моему методу в одном ил листвью все работает, а в другом не работает.
соответственно не работает и последний метод.
я в непонятках.


 
Сергей М. ©   (2006-06-23 08:20) [3]


> не работает и последний метод.


Ошибка не в приведенном коде.



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

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

Наверх




Память: 0.47 MB
Время: 0.094 c
2-1150823105
Vacek
2006-06-20 21:05
2006.07.09
Как можно в компоненте combobox выбрать, используя код, какую-н


2-1150452726
NSA
2006-06-16 14:12
2006.07.09
Как узнать колличество дней в месяце?


2-1151222288
Chort
2006-06-25 11:58
2006.07.09
DBEdit1 u UpDown1


2-1150861560
resuS
2006-06-21 07:46
2006.07.09
Проблема с модулем(Паскаль)


2-1150534664
Borisss
2006-06-17 12:57
2006.07.09
Как высчитать arccos(x)?