コード例 #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                int[]       selRows          = ((GridView)grdExpenditures.MainView).GetSelectedRows();
                DataRowView oCardTypeSetupID = (DataRowView)(((GridView)grdExpenditures.MainView).GetRow(selRows[0]));
                int         nCardTypeSetupID = Convert.ToInt32(oCardTypeSetupID["ID"]);

                CardTypeSetup oCardTypeSetup = db.CardTypeSetups.FirstOrDefault(p => p.CardTypeSetupID == nCardTypeSetupID);

                if (oCardTypeSetup == null)
                {
                    MessageBox.Show("select an item to edit", "Item not yet selected", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }


                fCardTypeSetup frm = new fCardTypeSetup();
                frm.ItemChanged = RefreshList;
                frm.ShowDlg(oCardTypeSetup, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #2
0
 private void btnNew_Click(object sender, EventArgs e)
 {
     try
     {
         fCardTypeSetup frm = new fCardTypeSetup();
         frm.ItemChanged = RefreshList;
         frm.ShowDlg(new CardTypeSetup(), false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }