Parameters are chunks of data that are passed along to some methods and functions. The method or function that receives a parameter uses that chunk of data in order to execute its action.

A ListBox has a method called “addRow” which, when called, adds a row to the ListBox. However, “addRow” needs to know what to put into the row it is adding so you send some data to “addRow” when you call it.

ListBox1.addRow “Golden Retriever”

“Golden Retriever” is a parameter of the type “string”. The addRow method expects to be given a string when it is called so that it can put that string into the row it adds to the ListBox.


DogsThe code in the “Add” PushButton’s Action event is:

ListBox1.addrow EditField1.text

When the Add button is clicked the contents of the EditField will be added after the last item in the list.




Some methods and functions require more than one parameter. In a ListBox with more than one column you may want to change the text in a particular cell.

 Dogs 2    Dogs

In the pictures above the Fox Terrier’s name has been changed from “Wiley” to “Constantine”. To do this the following code was put into the PushButton’s Action event:

ListBox1.Cell(ListBox1.ListIndex,1) = EditField1.text

The “Cell” method requires two parameters. It needs to know which row and column in the ListBox it should act on. The parameters are in parentheses and separated by a comma. The first parameter, “ListBox1.ListIndex” tells the Cell method which row to act on. The second parameter, “1”, tells the Cell method which column to act on. The Name column is column 1 because, in a ListBox, the first column is column 0.

NOTE: “ListBox1.ListIndex” is how you refer to the row that is currently selected in a ListBox.

Understanding parameters is very important in learning to program with Xojo®.