private void button1_Click(object sender, EventArgs e) { Dictionary <string, string> res = new Dictionary <string, string>(); List <Dictionary <string, string> > dat = new List <Dictionary <string, string> >(); switch (check()) { case 0: try { if (radioButton1.Checked) { res["parent_type"] = radioButton1.Text; res["page_count"] = textBox4.Text; } else if (radioButton2.Checked) { res["parent_type"] = radioButton2.Text; res["color"] = comboBox2.SelectedItem.ToString(); } else { MessageBox.Show("TEST", "uncorrect data", MessageBoxButtons.OK); } res["name"] = textBox1.Text; res["price"] = textBox2.Text; res["strih_code"] = textBox3.Text; res["type"] = comboBox1.SelectedItem.ToString(); Hide(); main_frm.NewItem(res); } catch { MessageBox.Show("Uncorrect input data", "ERROR!!!!!", MessageBoxButtons.OK); } break; case 1: MessageBox.Show("Uncorrect price", "uncorrect data", MessageBoxButtons.OK); break; case -1: MessageBox.Show("No price", "uncorrect data", MessageBoxButtons.OK); break; } }