LoneRanger123
Programmer
This code is used to create a Directory list. WHen I Run it and it gets to the ListItem->Caption = "hi"; (thats a test) line it gives an access violation. The code was copied from a Borland Help file Exampe and Edited (with my code); This was from TListView Add() help example. Any thoughts?
Code:
void __fastcall TSidebar::make_dir_listing(TObject *Sender)
{
TListItem *ListItem;
LIST->Items->Clear();
int i = 0;
for (i;i < 100;i++)
{
if (Dir_Entries[i].Name != "")
{
///ListItem = LIST->Items->Add();
//MessageDlg(Dir_Entries[i].Name.Pos(".") - 1,mtError,TMsgDlgButtons() << mbOK,0);
//ListItem->Caption = "hi";
ListItem = LIST->Items->Add();
ListItem->Caption = "hi";
//ListItem->ImageIndex = Dir_Entries[i].IconIndex;
}
}
}