private void gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { int selectedRow=e.Row; int scrollValue=gridMain.ScrollValue; FormTransactionEdit FormT=new FormTransactionEdit( ((JournalEntry)gridMain.Rows[e.Row].Tag).TransactionNum,AccountCur.AccountNum); FormT.ShowDialog(); if(FormT.DialogResult==DialogResult.Cancel) { return; } FillGrid(); gridMain.SetSelected(selectedRow,true); gridMain.ScrollValue=scrollValue; }
private void Add_Click(){ Transaction trans=new Transaction(); trans.UserNum=Security.CurUser.UserNum; Transactions.Insert(trans);//we now have a TransactionNum, and datetimeEntry has been set FormTransactionEdit FormT=new FormTransactionEdit(trans.TransactionNum,AccountCur.AccountNum); FormT.IsNew=true; FormT.ShowDialog(); if(FormT.DialogResult==DialogResult.Cancel){ //no need to try-catch, since no journal entries were saved. Transactions.Delete(trans); } FillGrid(); }