Beispiel #1
0
 private void UpdateData()
 {
     if (tabControl1.SelectedTab == tabList)
     {
         int      nowRow = dgv.CurrentRow.Index;
         DateTime oldDate
             = DateTime.Parse(dgv.Rows[nowRow].Cells[0].Value.ToString());
         string oldCategory = dgv.Rows[nowRow].Cells[1].Value.ToString();
         string oldItem     = dgv.Rows[nowRow].Cells[2].Value.ToString();
         int    oldMoney
             = int.Parse(dgv.Rows[nowRow].Cells[3].Value.ToString());
         string   oldRemarks = dgv.Rows[nowRow].Cells[4].Value.ToString();
         ItemForm frmItem    = new ItemForm(categoryDataSet1,
                                            oldDate,
                                            oldCategory,
                                            oldItem,
                                            oldMoney,
                                            oldRemarks);
         DialogResult drRet = frmItem.ShowDialog();
         if (drRet == DialogResult.OK)
         {
             dgv.Rows[nowRow].Cells[0].Value
                 = frmItem.monCalendar.SelectionRange.Start;
             dgv.Rows[nowRow].Cells[1].Value = frmItem.cmbCategory.Text;
             dgv.Rows[nowRow].Cells[2].Value = frmItem.txtItem.Text;
             dgv.Rows[nowRow].Cells[3].Value = int.Parse(frmItem.mtxtMoney.Text);
             dgv.Rows[nowRow].Cells[4].Value = frmItem.txtRemarks.Text;
         }
     }
 }
Beispiel #2
0
        private void AddData()
        {
            if (tabControl1.SelectedTab == tabList)
            {
                ItemForm     frmItem = new ItemForm(categoryDataSet1);
                DialogResult drRet   = frmItem.ShowDialog();

                if (drRet == DialogResult.OK)
                {
                    moneyDataSet.MoneyDataTable.AddMoneyDataTableRow(
                        frmItem.monCalendar.SelectionRange.Start,
                        frmItem.cmbCategory.Text,
                        frmItem.txtItem.Text,
                        int.Parse(frmItem.mtxtMoney.Text),
                        frmItem.txtRemarks.Text
                        );
                }
            }
        }