private void gvAdListgrid_CellContentClick(object sender, DataGridViewCellEventArgs e) { //Check whether user click on the first column if (e.ColumnIndex == 0 && e.RowIndex != -1) { int row; //Get the row index row = e.RowIndex; if (gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString() == "") { return; } //Create instance of the form2 class ADEntryForm obj = new ADEntryForm(Convert.ToInt32(gvAdListgrid.Rows[row].Cells["ADID"].Value)); //Bind the datagridview values in the second popup form obj.Controls["lblADID"].Text = gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString(); obj.Controls["btnSave"].Text = "Update"; obj.ShowDialog(); } if (e.ColumnIndex == 1 && e.RowIndex != -1) { int row; //Get the row index row = e.RowIndex; if (gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString() == "") { return; } //Create instance of the form2 class ADPaymentEntry obj = new ADPaymentEntry(Convert.ToInt32(gvAdListgrid.Rows[row].Cells["ADID"].Value)); //Bind the datagridview values in the second popup form obj.Controls["lblADID"].Text = gvAdListgrid.Rows[row].Cells["ADID"].Value.ToString(); obj.ShowDialog(); } }
private void advertisementsToolStripMenuItem_Click(object sender, EventArgs e) { ADEntryForm obj = new ADEntryForm(); obj.Show(this); }
private void btnAdEntryForm_Click(object sender, EventArgs e) { ADEntryForm obj = new ADEntryForm(); obj.Show(this); }