We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ComboBoxAdv.SelectedIndex changed behavior

Hello,

I recently upgraded from 4.2.0.37 to 5.1.1.0 and noticed that some of my code does not work the same way it did before. I tracked it down to the ComboBoxAdv control. Basically, I had one of these controls on a modal form and when the form was closed, I would access the SelectedIndex property to see what the user selected in the ComboBoxAdv control. Previously, this worked fine, but now it seems to be maintaining a 'm_beforeCreatedIndex' that is returned once the containing form is closed (because 'Created' = false). Is this intended behavior or bug? Seems strange to me that I shouldn't be allowed to access the correct SelectedIndex after the containing form closes (System.Windows.Forms.ComboBox allows this).

Thanks,
Terry

1 Reply

J. J.Nagarajan Syncfusion Team July 31, 2007 10:29 PM UTC

Hi Terry,

Thanks for your interest in Syncfusion product.

If you want to know the selected Index of the comboboxAdv control when you close the form then you can use SelectedIndex property of comboBoxAdv control. You can handle the From Closing event. Please refer to the following code snippet

private void newToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2();
form2.ShowDialog();
}

private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
Console.WriteLine(this.comboBoxAdv1.SelectedIndex.ToString());
}

I have attached the sample for your reference. You can download the sample from the following page.

http://websamples.syncfusion.com/samples/Tools.Windows/F65911/main.htm

Please refer to the sample and let me know if you have any questions.

Thanks,
Nagaraj

Loader.
Live Chat Icon For mobile
Up arrow icon