private void init_combo() { CRegion region; try { comboBoxRegion.Items.Clear(); region = new CRegion(connect); List <STRegion> list_r = region.GetListRegion(); string text = null; foreach (STRegion item in list_r) { comboBoxRegion.Items.Add(item.name); if (item.name == "Минск") { text = "Минск"; } } if (text != null) { comboBoxRegion.Text = text; } ; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void init_list() { dataGridViewRegion.Rows.Clear(); list = clRegion.GetListRegion(); CCountry country; try { if (list.Count > 0) { g_f = true; dataGridViewRegion.Rows.Add(list.Count); for (int i = 0; i < list.Count; i++) { dataGridViewRegion.Rows[i].Cells[0].Value = (i + 1).ToString(); dataGridViewRegion.Rows[i].Cells[1].Value = list[i].name; dataGridViewRegion.Rows[i].Cells[2].Value = list[i].shortname; country = new CCountry(connect, list[i].idcountry); dataGridViewRegion.Rows[i].Cells[3].Value = country.stCountry.shortname; if (flawour.Equals(list[i])) { gpos = i; } } dataGridViewRegion.AllowUserToAddRows = false; } else { dataGridViewRegion.AllowUserToAddRows = false; } } catch (Exception ex) { MessageBox.Show(ex.Message, ex.Source); } }