Пример #1
0
        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'";
            }
        }
Пример #2
0
        private void UpdateStoke_Load(object sender, EventArgs e)
        {
            UpdateStock stock = UpdateStockUtile.updateStock;

            textBox1.Text        = stock.ItemName1;
            textBox5.Text        = stock.ItemQuantity1.ToString();
            textBox2.Text        = stock.PricePerPiece1.ToString();
            comboBox1.Text       = stock.ItemType1;
            textBox4.Text        = stock.Milligram1.ToString();
            comboBox3.Text       = stock.ManufacturedBy1;
            textBox3.Text        = stock.MLNumber1;
            dateTimePicker1.Text = stock.DateAdded1.ToString();
            temp_name            = stock.ItemName1;
        }