Re: passing data from one form to another

Posted by Louis Goodman on February 25, 2009

In Reply to passing data from one form to another posted by cpoye on February 25, 2009

: How do I populate list boxes on one form from a the main form.

If from the source code of a form you want to populate a component on another form, just prefix the names of the components of the other form with that form's name.

Example: starting from the unit of Form1, put some data in Listbox1 and in Edit1 of Form2:

procedure TForm1.Button1Click(Sender: TObject);
  Form2.Listbox1.Items[0] := 'ABC'; 
  Form2.Listbox1.Items[1] := 'DEF'; 
  Form2.Listbox1.Items[1] := 'GHI'; 
  Form2.Edit1.Text := '1000'; 

Related articles


Follow Ups