コード例 #1
0
        /// <summary>
        ///     Sets the data bindings of the form,
        ///     including the selected value of the combo boxes, and events
        /// </summary>
        private void SetDataBindings()
        {
            //Simple control bindings
            txtAmount.Text = currentExpense.Amount.ToString();
            txtDetail.Text = currentExpense.Comment;
            dtPick.Value   = currentExpense.Date;

            //Expense category bindings
            cmbCategory.DataSource    = _expenseCategoryService.LoadAll();
            cmbCategory.DisplayMember = "NAME";
            cmbCategory.ValueMember   = "ID";
            cmbCategory.SelectedIndex = cmbCategory.FindString(currentExpense.Category.Name);

            //Payment Method bindings
            cmbPayment.DataSource    = _paymentMethodService.LoadAll();
            cmbPayment.DisplayMember = "NAME";
            cmbPayment.ValueMember   = "ID";
            cmbPayment.SelectedIndex = cmbPayment.FindString(currentExpense.Method.Name);

            //Event Bindings
            // This is to keep events from firing until all the data bindings are fully set
            cmbCategory.SelectedIndexChanged += cmbCategory_SelectedIndexChanged;
            cmbPayment.SelectedIndexChanged  += cmbPayment_SelectedIndexChanged;
            txtAmount.TextChanged            += txtAmount_TextChanged;
            txtDetail.TextChanged            += txtDetail_TextChanged;
            dtPick.ValueChanged += dtPick_ValueChanged;
        }
コード例 #2
0
ファイル: InputINUI.cs プロジェクト: qchouleur/MyHome
        private void SetDataBindings()
        {
            // Sets up the combo box of the income categories
            cmbCategory.DataSource    = _incomeCategoryService.LoadAll();
            cmbCategory.DisplayMember = "NAME";
            cmbCategory.ValueMember   = "ID";

            // Sets up the combo box with the payment methods
            cmbPayment.DataSource    = _paymentMethodService.LoadAll();
            cmbPayment.DisplayMember = "NAME";
            cmbPayment.ValueMember   = "ID";
        }
コード例 #3
0
        /// <summary>
        ///     Connects the combo boxes on the form with the data from the cache
        ///     and sets the date time pickers with data bindings to keep them
        ///     from crossing over
        /// </summary>
        /// <param name="sender">Standard sender object</param>
        /// <param name="e">Standard event object</param>
        private void RecurringExpenseInput_Load(object sender, EventArgs e)
        {
            // Sets up the combo box of the income categories
            cmbCategory.DataSource =
                _expenseCategoryService.LoadAll();
            cmbCategory.DisplayMember = "NAME";
            cmbCategory.ValueMember   = "ID";

            // Sets up the combo box with the payment methods
            cmbPayment.DataSource =
                _paymentMethodService.LoadAll();
            cmbPayment.DisplayMember = "NAME";
            cmbPayment.ValueMember   = "ID";

            // Sets up the date time pickers with data bindings to keep the dates from
            // crossing over in the wrong direction
            dtpStartDate.DataBindings.Add("MaxDate", dtpEndDate, "Value");
            dtpEndDate.DataBindings.Add("MinDate", dtpStartDate, "Value");
        }