Beispiel #1
0
        private void AddData()
        {
            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);
            }
        }
        private void UpdateData()
        {
            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[4].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.monCalender.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.textRemarks.Text;
            }
        }
Beispiel #3
0
 private void buttonAdd_Click(object sender, EventArgs e)
 {
     ItemForm     frmItem = new ItemForm();
     DialogResult drRet   = frmItem.ShowDialog();
 }