private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { selected = dataGridView1.CurrentCell.RowIndex; DataGridViewRow row = dataGridView1.Rows[selected]; if (e.ColumnIndex == 0) { UpdateStock stock = UpdateStockUtile.updateStock; stock.ItemName1 = row.Cells[1].Value.ToString(); stock.ItemQuantity1 = (int)row.Cells[2].Value; stock.PricePerPiece1 = (int)row.Cells[3].Value; stock.ItemType1 = row.Cells[4].Value.ToString(); MessageBox.Show(row.Cells[5].Value.GetType().ToString()); stock.Milligram1 = float.Parse(row.Cells[5].Value.ToString()); stock.ManufacturedBy1 = row.Cells[6].Value.ToString(); stock.MLNumber1 = row.Cells[7].Value.ToString(); stock.DateAdded1 = (DateTime)row.Cells[8].Value; frmUpdateStoke updateStoke = new frmUpdateStoke(); this.Hide(); updateStoke.Show(); } SqlConnection con = new SqlConnection(conSt); con.Open(); if (con.State == System.Data.ConnectionState.Open) { string show = "select * from AddStock where Itemname = 'txtname.Text'"; } }
private void button5_Click(object sender, EventArgs e) { frmUpdateStoke updateStoke = new frmUpdateStoke(); this.Hide(); updateStoke.Show(); }