コード例 #1
0
        private void frmCarAnalysis_Load(object sender, EventArgs e)
        {
            dtpDate.Format               = DateTimePickerFormat.Custom;
            dtpDate.CustomFormat         = "yyyy";
            cboCarCategory.DropDownStyle = ComboBoxStyle.DropDownList;
            // create instance of data set
            var ds = new DataSet();

            ds = Rates.getCatID(ds);


            cboCarCategory.Items.Clear();
            try
            {
                for (var i = 0; i < ds.Tables["cat"].Rows.Count; i++)
                {
                    cboCarCategory.Items.Add(ds.Tables[0].Rows[i][0].ToString().PadLeft(3, '0').Trim());
                }
            }
            catch (Exception)
            {
                Close();
                parent.Visible = true;
            }
        }
コード例 #2
0
        private void frmMakeBooking_Load(object sender, EventArgs e)
        {
            grpChoseCar.Visible    = false;
            btnMakeBooking.Visible = false;

            grpChoseCustomer.Visible = false;
            grpMakeBooking.Visible   = false;
            txtBookingNo.Text        = Booking.nextBookingNo().ToString("00000");

            var ds = new DataSet();

            ds = Rates.getCatID(ds);

            cboCarCategory.Items.Clear();
            try
            {
                for (var i = 0; i < ds.Tables["cat"].Rows.Count; i++)
                {
                    cboCarCategory.Items.Add(ds.Tables[0].Rows[i][0].ToString().PadLeft(3, '0').Trim());
                }

                var dsCust = new DataSet();
                dsCust = Customer.getCustInfo(dsCust);
                for (var i = 0; i < dsCust.Tables["cust"].Rows.Count; i++)
                {
                    cboCustomer.Items.Add(dsCust.Tables[0].Rows[i][0].ToString().PadLeft(3, '0') + " " +
                                          dsCust.Tables[0].Rows[i][1].ToString().Trim());
                }
            }
            catch (Exception)
            {
                Close();
                parent.Visible = true;
            }
        }
コード例 #3
0
        public void loadCombo()
        {
            // create instance of data set
            var ds = new DataSet();

            ds = Rates.getCatID(ds);

            //Remove existing items from combo box
            cboCarCategory.Items.Clear();

            //load data from ds
            try
            {
                for (var i = 0; i < ds.Tables["cat"].Rows.Count; i++)
                {
                    cboCarCategory.Items.Add(ds.Tables[0].Rows[i][0].ToString().PadLeft(3, '0'));
                }
            }
            catch (Exception)
            {
                Close();
                parent.Visible = true;
            }
        }