private void dgvSalesView_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (e.ColumnIndex.Equals(0))
         {
             frmSalesMaster objSalesEditMode = new frmSalesMaster(Convert.ToInt32(dgvSalesView.Rows[e.RowIndex].Cells[15].Value), rollFKey, cId);
             objSalesEditMode.MdiParent = this.MdiParent;
             objSalesEditMode.Show();
             this.Close();
             objSalesEditMode.WindowState = FormWindowState.Minimized;
             objSalesEditMode.WindowState = FormWindowState.Maximized;
         }
         if (e.ColumnIndex.Equals(1))
         {
             frmReportSelection objReportSelection = new frmReportSelection(Convert.ToInt32(dgvSalesView.Rows[e.RowIndex].Cells[15].Value), String.Empty, 1, rollFKey, cId);
             objReportSelection.MdiParent = this.MdiParent;
             this.Close();
             objReportSelection.Show();
             objReportSelection.WindowState = FormWindowState.Minimized;
             objReportSelection.WindowState = FormWindowState.Maximized;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString(), "dgvSalesView_CellContentClick", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #2
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     try
     {
         String MultiplePagePrimaryKey = String.Empty;
         int    NoChecked = 0;
         foreach (DataGridViewRow row in dgvPurchaseView.Rows)
         {
             NoChecked += Convert.ToInt32(row.Cells["chkSelection"].Value);
             if (Convert.ToInt32(row.Cells["chkSelection"].Value).Equals(1))
             {
                 MultiplePagePrimaryKey = MultiplePagePrimaryKey.Length > 0 ? MultiplePagePrimaryKey + "," + row.Cells["PurchaseMasterKey"].Value.ToString() : row.Cells["PurchaseMasterKey"].Value.ToString();
             }
             //More code here
         }
         if (NoChecked.Equals(0))
         {
             MessageBox.Show("For Single Selection Use Print Option and Multiple Selection So Checked At Least One CheckBox To Print", "dgvPurchaseView_CellContentClick", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             frmReportSelection objReportSelection = new frmReportSelection(0, MultiplePagePrimaryKey, NoChecked, rollFKey, cId);
             objReportSelection.MdiParent = this.MdiParent;
             this.Close();
             objReportSelection.Show();
             objReportSelection.WindowState = FormWindowState.Minimized;
             objReportSelection.WindowState = FormWindowState.Maximized;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString(), "btnPrint_Click", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }