Ejemplo n.º 1
0
        public BudgetAid()
        {
            InitializeComponent();

            #region Input events/initialization
            DateTextY_I.Text = DateTime.Now.ToString("yyyy");
            DateTextM_I.Text = DateTime.Now.ToString("MM");
            DateTextD_I.Text = DateTime.Now.ToString("dd");
            DateTextY_I.ForeColor = SystemColors.WindowText;
            DateTextM_I.ForeColor = SystemColors.WindowText;
            DateTextD_I.ForeColor = SystemColors.WindowText;

            CategoryTextBox_I.Enter += new System.EventHandler(CategoryTextBox_I_EnterHint);
            ValueTextBox_I.Enter += new System.EventHandler(ValueTextBox_EnterHint);
            DateTextY_I.Enter += new System.EventHandler(DateTextBoxY_EnterHint);
            DateTextM_I.Enter += new System.EventHandler(DateTextBoxM_EnterHint);
            DateTextD_I.Enter += new System.EventHandler(DateTextBoxD_EnterHint);

            CategoryTextBox_I.Leave += new System.EventHandler(CategoryTextBox_LeaveEmpty);
            ValueTextBox_I.Leave += new System.EventHandler(ValueTextBox_LeaveEmpty);
            DateTextY_I.Leave += new System.EventHandler(DateTextBoxY_LeaveEmpty);
            DateTextM_I.Leave += new System.EventHandler(DateTextBoxM_LeaveEmpty);
            DateTextD_I.Leave += new System.EventHandler(DateTextBoxD_LeaveEmpty);
            #endregion

            #region Analyze events/initialization

            DateITextY.Text = DateTime.Now.Year.ToString();
            DateITextM.Text = DateTime.Now.ToString("MM");
            DateITextD.Text = "01";
            DateFTextY.Text = DateTime.Now.Year.ToString();
            DateFTextM.Text = DateTime.Now.ToString("MM");
            DateFTextD.Text = DateTime.DaysInMonth(DateTime.Now.Year,
                                            DateTime.Now.Month).ToString();
            DateITextY.ForeColor = SystemColors.WindowText;
            DateITextM.ForeColor = SystemColors.WindowText;
            DateITextD.ForeColor = SystemColors.WindowText;
            DateFTextY.ForeColor = SystemColors.WindowText;
            DateFTextM.ForeColor = SystemColors.WindowText;
            DateFTextD.ForeColor = SystemColors.WindowText;

            DateITextY.Enter += new System.EventHandler(DateITextY_EnterHint);
            DateITextM.Enter += new System.EventHandler(DateITextM_EnterHint);
            DateITextD.Enter += new System.EventHandler(DateITextD_EnterHint);
            DateFTextY.Enter += new System.EventHandler(DateFTextY_EnterHint);
            DateFTextM.Enter += new System.EventHandler(DateFTextM_EnterHint);
            DateFTextD.Enter += new System.EventHandler(DateFTextD_EnterHint);
            CategoryTextBox_A.Enter += new System.EventHandler(CategoryTextBox_A_EnterHint);
            TargetTextBox.Enter += new System.EventHandler(TargetTextBox_EnterHint);

            DateITextY.Leave += new System.EventHandler(DateITextY_A_LeaveEmpty);
            DateITextM.Leave += new System.EventHandler(DateITextM_LeaveEmpty);
            DateITextD.Leave += new System.EventHandler(DateITextD_LeaveEmpty);
            DateFTextY.Leave += new System.EventHandler(DateFTextY_LeaveEmpty);
            DateFTextM.Leave += new System.EventHandler(DateFTextM_LeaveEmpty);
            DateFTextD.Leave += new System.EventHandler(DateFTextD_LeaveEmpty);
            CategoryTextBox_A.Leave += new System.EventHandler(CategoryTextBox_A_LeaveEmpty);
            TargetTextBox.Leave += new System.EventHandler(TargetTextBox_LeaveEmpty);
            #endregion

            TabCon.SelectedIndexChanged += new System.EventHandler(TabIndexed);

            this.FormClosing += Form_Closing;

            //TODO: handle no budget.xls exception
            ew = new ExcelWriter();
            if(File.Exists(ew.getDocPath())){
                AddressLabel.Text = ew.getDocPath();
            }
        }
Ejemplo n.º 2
0
        public BudgetAid()
        {
            InitializeComponent();

            #region Input events/initialization
            DateTextY_I.Text      = DateTime.Now.ToString("yyyy");
            DateTextM_I.Text      = DateTime.Now.ToString("MM");
            DateTextD_I.Text      = DateTime.Now.ToString("dd");
            DateTextY_I.ForeColor = SystemColors.WindowText;
            DateTextM_I.ForeColor = SystemColors.WindowText;
            DateTextD_I.ForeColor = SystemColors.WindowText;

            CategoryTextBox_I.Enter += new System.EventHandler(CategoryTextBox_I_EnterHint);
            ValueTextBox_I.Enter    += new System.EventHandler(ValueTextBox_EnterHint);
            DateTextY_I.Enter       += new System.EventHandler(DateTextBoxY_EnterHint);
            DateTextM_I.Enter       += new System.EventHandler(DateTextBoxM_EnterHint);
            DateTextD_I.Enter       += new System.EventHandler(DateTextBoxD_EnterHint);

            CategoryTextBox_I.Leave += new System.EventHandler(CategoryTextBox_LeaveEmpty);
            ValueTextBox_I.Leave    += new System.EventHandler(ValueTextBox_LeaveEmpty);
            DateTextY_I.Leave       += new System.EventHandler(DateTextBoxY_LeaveEmpty);
            DateTextM_I.Leave       += new System.EventHandler(DateTextBoxM_LeaveEmpty);
            DateTextD_I.Leave       += new System.EventHandler(DateTextBoxD_LeaveEmpty);
            #endregion

            #region Analyze events/initialization

            DateITextY.Text = DateTime.Now.Year.ToString();
            DateITextM.Text = DateTime.Now.ToString("MM");
            DateITextD.Text = "01";
            DateFTextY.Text = DateTime.Now.Year.ToString();
            DateFTextM.Text = DateTime.Now.ToString("MM");
            DateFTextD.Text = DateTime.DaysInMonth(DateTime.Now.Year,
                                                   DateTime.Now.Month).ToString();
            DateITextY.ForeColor = SystemColors.WindowText;
            DateITextM.ForeColor = SystemColors.WindowText;
            DateITextD.ForeColor = SystemColors.WindowText;
            DateFTextY.ForeColor = SystemColors.WindowText;
            DateFTextM.ForeColor = SystemColors.WindowText;
            DateFTextD.ForeColor = SystemColors.WindowText;

            DateITextY.Enter        += new System.EventHandler(DateITextY_EnterHint);
            DateITextM.Enter        += new System.EventHandler(DateITextM_EnterHint);
            DateITextD.Enter        += new System.EventHandler(DateITextD_EnterHint);
            DateFTextY.Enter        += new System.EventHandler(DateFTextY_EnterHint);
            DateFTextM.Enter        += new System.EventHandler(DateFTextM_EnterHint);
            DateFTextD.Enter        += new System.EventHandler(DateFTextD_EnterHint);
            CategoryTextBox_A.Enter += new System.EventHandler(CategoryTextBox_A_EnterHint);
            TargetTextBox.Enter     += new System.EventHandler(TargetTextBox_EnterHint);

            DateITextY.Leave        += new System.EventHandler(DateITextY_A_LeaveEmpty);
            DateITextM.Leave        += new System.EventHandler(DateITextM_LeaveEmpty);
            DateITextD.Leave        += new System.EventHandler(DateITextD_LeaveEmpty);
            DateFTextY.Leave        += new System.EventHandler(DateFTextY_LeaveEmpty);
            DateFTextM.Leave        += new System.EventHandler(DateFTextM_LeaveEmpty);
            DateFTextD.Leave        += new System.EventHandler(DateFTextD_LeaveEmpty);
            CategoryTextBox_A.Leave += new System.EventHandler(CategoryTextBox_A_LeaveEmpty);
            TargetTextBox.Leave     += new System.EventHandler(TargetTextBox_LeaveEmpty);
            #endregion

            TabCon.SelectedIndexChanged += new System.EventHandler(TabIndexed);

            this.FormClosing += Form_Closing;

            //TODO: handle no budget.xls exception
            ew = new ExcelWriter();
            if (File.Exists(ew.getDocPath()))
            {
                AddressLabel.Text = ew.getDocPath();
            }
        }