private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = (ComboBox)sender; Base_Form baseForm = new Base_Form(); BookLoad_Form bookLoad1 = new BookLoad_Form(); BookLoad_Form bookLoad3 = new BookLoad_Form(); if (cb.SelectedIndex == 0) { UserControl7 userControl = new UserControl7(); panel2.Controls.Add(userControl); comboBox2.Visible = false; bookLoad1.ShowDialog(); bookLoad1.Location = new Point(200, 200); } else if (cb.SelectedIndex == 1) { UserControl7 userControl = new UserControl7(); panel2.Controls.Add(userControl); comboBox2.Visible = false; ds.ReadXml(@"D:\eclipse\git\C-Sharp_2020_2\XMLFile1.xml"); dgv.DataSource = ds.Tables[0]; userControl.dataLoad(dgv); MessageBox.Show("XML파일의 데이터를 가져왔습니다!!!!"); } else if (cb.SelectedIndex == 2) { UserControl7 userControl = new UserControl7(); panel2.Controls.Add(userControl); comboBox2.Visible = false; bookLoad3.ShowDialog(); bookLoad3.Location = new Point(200, 200); } }
private void comboBox3_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = (ComboBox)sender; Base_Form baseForm = new Base_Form(); BookLoad_Form bookLoad2 = new BookLoad_Form(); if (cb.SelectedIndex == 0) { UserControl7 userControl = new UserControl7(); panel2.Controls.Add(userControl); comboBox3.Visible = false; dgv.DataSource = userControl.dataGridView1.DataSource; DataTable dt = GetDataTableFromDGV(dgv); ds.Tables.Add(dt); ds.WriteXml(File.OpenWrite(@"D:\eclipse\git\C-Sharp_2020_2\XMLFile1.xml")); MessageBox.Show("데이터를 XML파일로 저장했습니다!!!!"); } else if (cb.SelectedIndex == 1) { UserControl7 userControl = new UserControl7(); panel2.Controls.Add(userControl); comboBox3.Visible = false; bookLoad2.ShowDialog(); bookLoad2.Location = new Point(200, 200); } }
private void comboBox4_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = (ComboBox)sender; Base_Form baseForm = new Base_Form(); ISBN_Redundant_Form isbn = new ISBN_Redundant_Form(); Id_Redundant_Form id = new Id_Redundant_Form(); if (cb.SelectedIndex == 0) { UserControl7 userControl = new UserControl7(); panel2.Controls.Add(userControl); comboBox4.Visible = false; isbn.ShowDialog(); isbn.Location = new Point(200, 200); } if (cb.SelectedIndex == 1) { UserControl7 userControl = new UserControl7(); panel2.Controls.Add(userControl); comboBox4.Visible = false; id.ShowDialog(); id.Location = new Point(200, 200); } }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { ComboBox cb = (ComboBox)sender; Base_Form baseForm = new Base_Form(); SignChange1 signChange1 = new SignChange1(); SignChange2 signChange2 = new SignChange2(); SignChange3 signChange3 = new SignChange3(); SignChange4 signChange4 = new SignChange4(); SignChange5 signChange5 = new SignChange5(); SignChange6 signChange6 = new SignChange6(); int mainFormx = baseForm.Location.X; int mainFormy = baseForm.Location.Y; int mainformwidth = baseForm.Size.Width; int mainformheight = baseForm.Size.Height; int childformwidth1 = signChange1.Size.Width; int childformheight1 = signChange1.Size.Height; int childformwidth2 = signChange2.Size.Width; int childformheight2 = signChange2.Size.Height; int childformwidth3 = signChange3.Size.Width; int childformheight3 = signChange3.Size.Height; int childformwidth4 = signChange4.Size.Width; int childformheight4 = signChange4.Size.Height; int childformwidth5 = signChange5.Size.Width; int childformheight5 = signChange5.Size.Height; int childformwidth6 = signChange6.Size.Width; int childformheight6 = signChange6.Size.Height; if (cb.SelectedIndex == 0) { signChange1.Show(); signChange1.Location = new Point(mainFormx + (mainformwidth / 2) - (childformwidth1 / 2), mainFormy + (mainformheight / 2) - (childformheight1 - 2)); } if (cb.SelectedIndex == 1) { signChange2.Show(); signChange2.Location = new Point(mainFormx + (mainformwidth / 2) - (childformwidth2 / 2), mainFormy + (mainformheight / 2) - (childformheight2 - 2)); } if (cb.SelectedIndex == 2) { signChange3.Show(); signChange3.Location = new Point(mainFormx + (mainformwidth / 2) - (childformwidth3 / 2), mainFormy + (mainformheight / 2) - (childformheight3 - 2)); } if (cb.SelectedIndex == 3) { signChange4.Show(); signChange4.Location = new Point(mainFormx + (mainformwidth / 2) - (childformwidth4 / 2), mainFormy + (mainformheight / 2) - (childformheight4 - 2)); } if (cb.SelectedIndex == 4) { signChange5.Show(); signChange5.Location = new Point(mainFormx + (mainformwidth / 2) - (childformwidth5 / 2), mainFormy + (mainformheight / 2) - (childformheight5 - 2)); } if (cb.SelectedIndex == 5) { signChange6.Show(); signChange6.Location = new Point(mainFormx + (mainformwidth / 2) - (childformwidth6 / 2), mainFormy + (mainformheight / 2) - (childformheight6 - 2)); } }