DesktopHelper.UI.ConfigForm.comboBoxSheng_SelectedIndexChanged C# (CSharp) Method

comboBoxSheng_SelectedIndexChanged() private method

private comboBoxSheng_SelectedIndexChanged ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void comboBoxSheng_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (comboBoxSheng.SelectedItem != null)
                {
                    ComboBoxItem sheng = (ComboBoxItem)comboBoxSheng.SelectedItem;
                    DataTable table_CityShi = _data.GetCityData(ConfigData.CityType.Shi, sheng.Value);
                    if (table_CityShi != null && table_CityShi.Rows.Count > 0)
                    {
                        comboBoxShi.Items.Clear();
                        foreach (DataRow dr in table_CityShi.Rows)
                        {
                            string shi = dr["Name"].ToString();
                            comboBoxShi.Items.Add(new ComboBoxItem(shi, shi));
                        }
                    }
                }
                if (bool_IsStarting)
                {
                    for (int i = 0; i < comboBoxShi.Items.Count; i++)
                    {
                        ComboBoxItem item = comboBoxShi.Items[i] as ComboBoxItem;
                        if (item.Value.Equals(str_SHI))
                        {
                            comboBoxShi.SelectedIndex = i;
                            break;
                        }
                    }
                }
                else
                {
                    BtnApply.Enabled = true;
                    comboBoxShi.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                log.WriteLog(ex.ToString());
            }
        }