コード例 #1
0
ファイル: Form1.cs プロジェクト: takuminish/Kakeibo
        private void AddData()
        {
            ItemForm     frmItem = new ItemForm(categoryDataSet1);
            DialogResult drRet   = frmItem.ShowDialog();

            if (drRet == DialogResult.OK)
            {
                moneyDataSet.DataTable1.AddDataTable1Row(
                    frmItem.monCalendar.SelectionRange.Start,
                    frmItem.cmbCategory.Text,
                    frmItem.txtmiddlecategory.Text,
                    frmItem.textItem.Text,
                    int.Parse(frmItem.mtxtMoney.Text),
                    frmItem.txtRemarks.Text
                    );
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: takuminish/Kakeibo
        private void UpdateData()
        {
            int      nowRow            = dgv.CurrentRow.Index;
            DateTime oldDate           = DateTime.Parse(dgv.Rows[nowRow].Cells[0].Value.ToString());
            string   oldBigcategory    = dgv.Rows[nowRow].Cells[1].Value.ToString();
            string   oldMuddlecategory = dgv.Rows[nowRow].Cells[2].Value.ToString();
            string   olditem           = dgv.Rows[nowRow].Cells[3].Value.ToString();
            int      oldMoney          = int.Parse(dgv.Rows[nowRow].Cells[4].Value.ToString());
            string   oldremarks        = dgv.Rows[nowRow].Cells[5].Value.ToString();

            ItemForm     frmItem = new ItemForm(categoryDataSet1, oldDate, oldBigcategory, oldMuddlecategory, 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.textItem.Text;
                dgv.Rows[nowRow].Cells[3].Value = int.Parse(frmItem.mtxtMoney.Text);
                dgv.Rows[nowRow].Cells[4].Value = frmItem.txtRemarks.Text;
            }
        }