Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ComboBox - re-initialize

Status
Not open for further replies.

guava65

Programmer
Jul 20, 2001
238
US
I put a combo box onto a form and used it to initialize a text field in a database. When I exit the program and re-enter, the combo box returns to the default text.

Is there a way to have the combobox return to the selected item and/or is there another method to achieve the same goal?
Mahalo,
cg
 
Set a variable in a global unit to the ItemIndex of what was selected?

Some more details would be handy.
 
Code:
var n : integer; s : string;
s := Database.Field.Text; // Whatever data
n := ListBox.Items.IndexOf(s);
if n > -1 then
   ListBox.ItemIndex := n;

HTH
TonHu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top