private void toolStripButton2_Click(object sender, EventArgs e) { frmManager manager = new frmManager(); manager.MdiParent = this; manager.Show(); }
public frmManager select(int s) { frmManager manager = new frmManager(); try { openConn(); com = "SELECT Sr,Medicine,Expiry,Intensity,Quantity,Consumer,Customer,Description,Manufacturer,Contact,Country FROM Entries WHERE Sr = '" + s + "'"; command = new SqlCommand(com, get()); SqlDataReader dr = command.ExecuteReader(); while (dr.Read()) { manager.textBox1.Text = dr["Sr"] + ""; manager.textBox2.Text = dr["Medicine"] + ""; manager.dateTimePicker1.Value = DateTime.Parse(dr["Expiry"] + ""); manager.textBox3.Text = dr["Intensity"] + ""; manager.maskedTextBox1.Text = dr["Quantity"] + ""; manager.maskedTextBox2.Text = dr["Consumer"] + ""; manager.maskedTextBox3.Text = dr["Customer"] + ""; manager.textBox4.Text = dr["Description"] + ""; manager.textBox5.Text = dr["Manufacturer"] + ""; manager.maskedTextBox4.Text = dr["Contact"] + ""; manager.comboBox1.SelectedItem = dr["Country"] + ""; } dr.Dispose(); closeConn(); } catch (SqlException e) { MessageBox.Show(e.ToString()); } return(manager); }
private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex > -1) { int sr = int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value + ""); frmManager m = module.select(sr); textBox1.Text = m.textBox1.Text; textBox2.Text = m.textBox2.Text; textBox3.Text = m.textBox3.Text; textBox4.Text = m.textBox4.Text; textBox5.Text = m.textBox5.Text; maskedTextBox1.Text = m.maskedTextBox1.Text; maskedTextBox2.Text = m.maskedTextBox2.Text; maskedTextBox3.Text = m.maskedTextBox3.Text; maskedTextBox4.Text = m.maskedTextBox4.Text; comboBox1.SelectedItem = m.comboBox1.SelectedItem; dateTimePicker1.Value = m.dateTimePicker1.Value; selectFunc(); setStatus(true, textBox2.Text + " Is Selected !"); } }
public void setAll(frmManager m) { if (openConn()) { try { com = "INSERT INTO Entries Values('" + m.textBox1.Text + "','" + m.textBox2.Text + "','" + m.textBox3.Text + "','" + m.dateTimePicker1.Value + "','" + m.maskedTextBox1.Text + "','" + m.maskedTextBox2.Text + "','" + m.maskedTextBox3.Text + "','" + m.textBox4.Text + "','" + m.textBox5.Text + "','" + m.maskedTextBox4.Text + "','" + m.comboBox1.SelectedItem + "')"; command = new SqlCommand(com, get()); command.ExecuteNonQuery(); closeConn(); } catch (SqlException e) { MessageBox.Show(e.ToString()); } } else { closeConn(); } }