On 21/10/12 3:25, Timothy Groves wrote:
So I am trying to add a TListBox to my program.  Relevant code is below.

   TfrmFicMake = class(TForm)
     .
     .
     .
     lstVolumeList: TListBox;
     .
     .
     .
   end;

procedure TfrmFicMake.btnAddVolumeClick(Sender: TObject);
var
   index : integer;
begin
   frmCreateVolume.ShowModal;
   lstVolumeList.Clear;
   for index := 0 to (Length (Volumes) - 1) do
       lstVolumeList.AddItem (Volumes [index].VolumeName);
end;

The AddItem method takes two parameters, a string and an associated TObject. If you only want to use the listbox to store a list of string items use
  lstVolumeList.Items.Add(Volumes[index].VolumeName);

Howard


--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to