Forum > LCL

TComboBox Question

(1/1)

xinyiman:
How do I select code from the last value of my TComboBox? Excuse the stupid question!

BlueIcaro:
Did you tried:


--- Quote --- Value :=  MyComboBox.Items[MyComboBox.Count-1].Text;

--- End quote ---

/BlueIcaro

xinyiman:
resolved with

Cmb_Turni.ItemIndex:=NumMax-1; //because index start to 0

eny:

--- Quote from: xinyiman on August 03, 2010, 12:25:47 pm ---resolved with

Cmb_Turni.ItemIndex:=NumMax-1; //because index start to 0

--- End quote ---
Not resolved and a dorment bug!
BlueIcaro gave the right hint:

if Cmb_turni.Count > 0 then
  Cmb_turni.ItemIndex := Cmb_turni.Count-1;

xinyiman:

--- Quote from: eny on August 03, 2010, 06:16:16 pm ---
--- Quote from: xinyiman on August 03, 2010, 12:25:47 pm ---resolved with

Cmb_Turni.ItemIndex:=NumMax-1; //because index start to 0

--- End quote ---
Not resolved and a dorment bug!
BlueIcaro gave the right hint:

if Cmb_turni.Count > 0 then
  Cmb_turni.ItemIndex := Cmb_turni.Count-1;

--- End quote ---

Thank you

Navigation

[0] Message Index

Go to full version