Пример #1
0
        private void GrdMain_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
                {
                    DataGridViewRow dgvr = this.grdMain.Rows[e.RowIndex];
                    if (dgvr.DataBoundItem != null)
                    {
                        DataRowView drv     = dgvr.DataBoundItem as DataRowView;
                        long        lUserID = drv["UserID"] == DBNull.Value ?
                                              0 : Convert.ToInt64(drv["UserID"]);

                        if (lUserID > 0)
                        {
                            frmAddUser frm = new frmAddUser(lUserID);
                            frm.ShowDialog();

                            LoadDataSource();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                frmAddUser frm = new frmAddUser(0);
                frm.ShowDialog();

                LoadDataSource();
            }
            catch (Exception ex)
            {
                LB.WinFunction.LBCommonHelper.DealWithErrorMessage(ex);
            }
        }