Ejemplo n.º 1
0
        private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (namaForm == "FrmStock")
            {
                FrmStock stock = new FrmStock();
                foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                {
                    kdObat = row.Cells[0].Value.ToString();
                    merek  = row.Cells[1].Value.ToString();
                    nmObat = row.Cells[2].Value.ToString();
                }
                stock.Dispose();
                this.Close();
            }
            else if (namaForm == "FrmPenjualan" || namaForm == "FrmPembelian")
            {
                foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                {
                    kdObat  = row.Cells[0].Value.ToString();
                    merek   = row.Cells[1].Value.ToString();
                    nmObat  = row.Cells[2].Value.ToString();
                    hrgObat = row.Cells[8].Value.ToString();
                }

                this.Close();
            }
        }
Ejemplo n.º 2
0
        private void dataGridView1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {
                if (namaForm == "FrmStock")
                {
                    FrmStock stock = new FrmStock();
                    foreach (DataGridViewRow row in dataGridView1.SelectedRows)
                    {
                        stock.kdObatTxt.Text = row.Cells[0].Value.ToString();
                        stock.merekTxt.Text  = row.Cells[1].Value.ToString();
                        stock.nmObatTxt.Text = row.Cells[2].Value.ToString();
                    }
                    stock.Dispose();
                    this.Close();
                }

                else if (namaForm == "FrmPembelian")
                {
                }
            }
        }