ComboBox.GetItemData

string ComboBox.GetItemData ( 

string ObjectName,

number Index )

Example 1

-- Adds a new item with item text "Item One" and associated data "C:\\One.txt"
-- to the combobox object called "ComboBox1".
ComboBox.AddItem("ComboBox1", "Item One", "C:\\One.txt");

-- Check to see if any errors occurred calling the ComboBox.AddItem action.
-- If any error occurred, display the error message.
error = Application.GetLastError();
if (error ~= 0) then
   Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end

-- Gets the item data of the first item in the combobox object.
item_data = ComboBox.GetItemData("ComboBox1", 1);

-- If the item has item data, display its contents, otherwise notify that there was none.
if (item_data ~= "") then
   Dialog.Message("Item Data", "The item data in index 1 is "..item_data, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
   Dialog.Message("Item Data", "There is no item data at index 1.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end

Adds an item to the combobox object "ComboBox1", and then retrieves the data from the added item. The retrieved data is displayed to the user.

See also:  Related Actions