private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e) { int acctNum = PIn.PInt(table.Rows[gridMain.GetSelectedIndex()]["AccountNum"].ToString()); if (acctNum == 0) { MsgBox.Show(this, "This account is generated automatically, and there is currently no way to view the detail. It is the sum of all income minus all expenses for all previous years."); return; } DateTime asofDate; if (textDate.errorProvider1.GetError(textDate) != "") //error { asofDate = DateTime.Today; } else { asofDate = PIn.PDate(textDate.Text); } Account acct = Accounts.GetAccount(acctNum); FormJournal FormJ = new FormJournal(acct); FormJ.InitialAsOfDate = asofDate; FormJ.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 gridMain_CellDoubleClick(object sender,ODGridClickEventArgs e) { long acctNum=PIn.Long(table.Rows[gridMain.GetSelectedIndex()]["AccountNum"].ToString()); if(acctNum==0) { MsgBox.Show(this,"This account is generated automatically, and there is currently no way to view the detail. It is the sum of all income minus all expenses for all previous years."); return; } DateTime asofDate; if(textDate.errorProvider1.GetError(textDate) != ""){//error asofDate=DateTime.Today; } else{ asofDate=PIn.Date(textDate.Text); } Account acct=Accounts.GetAccount(acctNum); FormJournal FormJ=new FormJournal(acct); FormJ.InitialAsOfDate=asofDate; FormJ.ShowDialog(); FillGrid(); for(int i=0;i<table.Rows.Count;i++) { if(table.Rows[i]["AccountNum"].ToString()==acctNum.ToString()) { gridMain.SetSelected(i,true); } } }