I am using this code at the moment. I need to get the String value of the selected item of a ComboBox:
procedure TForm5.BitBtn5Click(Sender: TObject);
var c,k,t,g: string;
begin
//Get the name of the items
c := ComboBox1.Items[ComboBox1.ItemIndex];
k := ComboBox2.Items[ComboBox2.ItemIndex];
t := ComboBox3.Items[ComboBox3.ItemIndex];
g := ComboBox4.Items[ComboBox4.ItemIndex];
//Show it
ShowMessage(c);
end;
The ComboBoxes have items inside as you can see here because I fill them in an onCreate
event of the Form5. When I press the BitBtn5 I have an error like this:
I have googled my problem and I have found the code is the same, but I have that error. Do you have any idea? (I am using lazarus 1.2.4)