private void Edit_Click() { if (gridMain.GetSelectedIndex() == -1) { MsgBox.Show(this, "Please pick an account first."); return; } int acctNum = PIn.PInt(table.Rows[gridMain.GetSelectedIndex()]["AccountNum"].ToString()); if (acctNum == 0) { MsgBox.Show(this, "This account is generated automatically, and cannot be edited."); return; } Account acct = Accounts.GetAccount(acctNum); FormAccountEdit FormA = new FormAccountEdit(acct); FormA.ShowDialog(); FillGrid(); for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i]["AccountNum"].ToString() == acctNum.ToString()) { gridMain.SetSelected(i, true); } } }
private void Add_Click() { Account acct = new Account(); acct.AcctType = AccountType.Asset; acct.AccountColor = Color.White; FormAccountEdit FormA = new FormAccountEdit(acct); FormA.IsNew = true; FormA.ShowDialog(); FillGrid(); }
private void Edit_Click() { if(gridMain.GetSelectedIndex()==-1){ MsgBox.Show(this,"Please pick an account first."); return; } long acctNum=PIn.Long(table.Rows[gridMain.GetSelectedIndex()]["AccountNum"].ToString()); if(acctNum==0) { MsgBox.Show(this,"This account is generated automatically, and cannot be edited."); return; } Account acct=Accounts.GetAccount(acctNum); FormAccountEdit FormA=new FormAccountEdit(acct); FormA.ShowDialog(); FillGrid(); for(int i=0;i<table.Rows.Count;i++){ if(table.Rows[i]["AccountNum"].ToString()==acctNum.ToString()){ gridMain.SetSelected(i,true); } } }
private void Add_Click() { Account acct=new Account(); acct.AcctType=AccountType.Asset; acct.AccountColor=Color.White; FormAccountEdit FormA=new FormAccountEdit(acct); FormA.IsNew=true; FormA.ShowDialog(); FillGrid(); }