المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : WinForms Comboboxes



C# Programming
05-06-2009, 04:00 AM
Hi,

I have two comboboxes, cbPhysicalCountry and cbPostalCountry. Both Comboboxes are populated via a dataset. How can I set the cbPostalCountry = cbPhysicalCountry when the user checks the checkbox "UsePhysicalCountry"?

I populate my comboboxes with the following code

DataSet dsPhysicalCountry = WCFService.GetCountry();

cbPhysicalCountry.DataSource = dsPhysicalCountry.Tables["Country"];
cbPhysicalCountry.DisplayMember = "Country";
cbPhysicalCountry.ValueMember = "Id";

When the checkbox_checkchanged event fires I have the following code,

if(checkbox.checked == true)
{
cbPostalCountry.SelectedItem = cbPhysicalCountry.SelectedItem;
}

Thank you in advance...

Illegal Operation