예제 #1
0
        //Method to identify selected field in data grid view which is used to pre-populate contorls within a form.
        private void ViewAccountDetails(int tabIndex)
        {
            DataTable dTable = dgvAccounts.DataSource as DataTable;

            if (dTable != null && dTable.Rows.Count > 0)
            {
                DataGridViewRow dgvRow = dgvAccounts.CurrentRow;
                //If a selection is made
                if (dgvRow != null)
                {
                    int accountNumber = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.AccountNumber)].Value);
                    int customerID    = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.CustomerID)].Value);
                    using (ViewAccount frmViewAccount = new ViewAccount(accountNumber, customerID, tabIndex))
                    {
                        //Populate the ViewAccount form with selected values
                        frmViewAccount.ShowDialog();
                    }
                    PrimeGrid();
                }
                else
                {
                    MessageBox.Show("No Selection Made", "ERROR");
                }
            }
        }
 //Method to identify selected field in data grid view which is used to pre-populate contorls within a form.
 private void ViewAccountDetails(int tabIndex)
 {
     DataTable dTable = dgvAccounts.DataSource as DataTable;
     if (dTable != null && dTable.Rows.Count > 0)
     {
         DataGridViewRow dgvRow = dgvAccounts.CurrentRow;
         //If a selection is made
         if (dgvRow != null)
         {
             int accountNumber = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.AccountNumber)].Value);
             int customerID = Convert.ToInt32(dgvRow.Cells[Convert.ToInt32(MainGridCloumns.CustomerID)].Value);
             using (ViewAccount frmViewAccount = new ViewAccount(accountNumber, customerID, tabIndex))
             {
                 //Populate the ViewAccount form with selected values
                 frmViewAccount.ShowDialog();
             }
             PrimeGrid();
         }
         else
             MessageBox.Show("No Selection Made", "ERROR");
     }
 }