當前位置: 首頁>>代碼示例>>C#>>正文


C# Forms.DateTimePicker類代碼示例

本文整理匯總了C#中System.Windows.Forms.DateTimePicker的典型用法代碼示例。如果您正苦於以下問題:C# DateTimePicker類的具體用法?C# DateTimePicker怎麽用?C# DateTimePicker使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DateTimePicker類屬於System.Windows.Forms命名空間,在下文中一共展示了DateTimePicker類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: listarMicros

        public static void listarMicros(DataGridView dgMicros, String patente, String patenteEstimada,
            String modelo, String modeloEstimado, DateTimePicker dtpFechaAlta, String marca, String tipoServicio,
            decimal numero, bool mostrarDeshabilitados, bool mostrarHabilitados)
        {
            try
            {
                using (SqlConnection conn = new SqlConnection(main.connString))
                using (SqlCommand cmd = new SqlCommand("BONDIOLA.listarMicros", conn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    SQL_Library.agregarParametro(cmd, "@patente", patente);
                    SQL_Library.agregarParametro(cmd, "@patenteEstimada", patenteEstimada);
                    SQL_Library.agregarParametro(cmd, "@modelo", modelo);
                    SQL_Library.agregarParametro(cmd, "@modeloEstimado", modeloEstimado);
                    SQL_Library.agregarParametroFecha(cmd, dtpFechaAlta, "@fecha_alta");
                    SQL_Library.agregarParametro(cmd, "@marca", marca);
                    SQL_Library.agregarParametro(cmd, "@tipoServicio", tipoServicio);
                    SQL_Library.agregarParametro(cmd, "@numero", numero);
                    SQL_Library.agregarParametro(cmd, "@mostrarDeshabilitados", mostrarDeshabilitados);
                    SQL_Library.agregarParametro(cmd, "@mostrarHabilitados", mostrarHabilitados);
                    SQL_Library.agregarParametro(cmd, "@fechaActual", Properties.Settings.Default.Fecha);

                    SQL_Library.llenarDataGrid(dgMicros, conn, cmd);
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
開發者ID:juanmjacobs,項目名稱:gestion2c2013,代碼行數:30,代碼來源:Listado.cs

示例2: ListarEntredatas

        public void ListarEntredatas(DataGridView dgv, string codigo, DateTimePicker dtpInicial, DateTimePicker dtpFinal)
        {
            try
            {
                InstanciarBanco();
                dgv.DataSource = ((from mov in _banco.MovimentacaoProduto
                                   join prod in _banco.Produto on new { Codigo = mov.Codigo } equals new { Codigo = prod.Codigo }
                                   where prod.Codigo == codigo && mov.Data >= dtpInicial.Value.Date && mov.Data <= dtpFinal.Value.Date
                                   group new { mov, prod } by new
                                   {
                                       mov.Codigo,
                                       prod.Nome
                                   } into g
                                   select new
                                   {
                                       Código = g.Key.Codigo,
                                       Nome = g.Key.Nome,
                                       Quantidade = g.Sum(p => p.mov.Quantidade),
                                       Total = g.Sum(p => p.mov.Valor)
                                   }).Distinct()).ToList();

            }
            catch (CustomException erro)
            {
                DialogMessage.MessageFullComButtonOkIconeDeInformacao(erro.Message, "Aviso");
            }
            catch (Exception erro)
            {
                DialogMessage.MessageComButtonOkIconeErro(erro.Message, "Erro");
            }
        }
開發者ID:PablusVinii,項目名稱:Caixapadariav2,代碼行數:31,代碼來源:MovimentacaoProdutoRepositorio.cs

示例3: CreateControl

		/// <summary>
		/// Create the editor control
		/// </summary>
		/// <returns></returns>
		protected override Control CreateControl()
		{
			System.Windows.Forms.DateTimePicker dtPicker = new System.Windows.Forms.DateTimePicker();
			dtPicker.Format = DateTimePickerFormat.Time;
			dtPicker.ShowUpDown = true;
			return dtPicker;
		}
開發者ID:Xavinightshade,項目名稱:ipsimulator,代碼行數:11,代碼來源:TimePicker.cs

示例4: DateTimePickerPresentation

        /// <summary>
        /// Initializes a new instance of the 'DateTimePickerPresentation' class.
        /// </summary>
        /// <param name="maskedTextBox">.NET MaskedTextBox reference.</param>
        /// <param name="dateTimePicker">.NET DateTimePicker reference.</param>
        public DateTimePickerPresentation(MaskedTextBox maskedTextBox, DateTimePicker dateTimePicker)
        {
            mMaskedTextBoxIT = maskedTextBox;
            mDateTimePickerIT = dateTimePicker;
            if (mMaskedTextBoxIT != null)
            {
                // Create and configure the ErrorProvider control.
                mErrorProvider = new ErrorProvider();
                mErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;

                // Link MaskedTextBox control events.
                mMaskedTextBoxIT.GotFocus += new EventHandler(HandleMaskedTextBoxITGotFocus);
                mMaskedTextBoxIT.LostFocus += new EventHandler(HandleMaskedTextBoxITLostFocus);
                mMaskedTextBoxIT.TextChanged += new EventHandler(HandleMaskedTextBoxITTextChanged);
                mMaskedTextBoxIT.EnabledChanged += new EventHandler(HandleMaskedTextBoxITEnabledChanged);
                mMaskedTextBoxIT.KeyDown += new KeyEventHandler(HandleMaskedTextBoxITKeyDown);
            }

            if (dateTimePicker != null)
            {
                mDateTimePickerIT.Enter += new System.EventHandler(HandleDateTimePickerITEnter);
                mDateTimePickerIT.KeyUp += new System.Windows.Forms.KeyEventHandler(HandleDateTimePickerITKeyUp);
                mDateTimePickerIT.DropDown += new System.EventHandler(HandleDateTimePickerITDropDown);
                mDateTimePickerIT.CloseUp += new System.EventHandler(HandleDateTimePickerCloseUp);
            }
        }
開發者ID:sgon1853,項目名稱:UPM_MDD_Thesis,代碼行數:31,代碼來源:DateTimePickerPresentation.cs

示例5: IsValidTimeRange

        public static bool IsValidTimeRange(DateTimePicker dtpStartTime, DateTimePicker dtpEndTime, NumericUpDown numericUpDown)
        {
            // Check if the start time is after the end time.
            if (dtpStartTime.Value > dtpEndTime.Value)
            {
                MessageBox.Show("The end time must be greater than the start time.", "Entry Error", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                dtpEndTime.Focus();
                return false;
            }

            // TODO: Bug - The date time picker does not roll back to the previous day if the default
            // end time is set for the next day. For example, if we start the program at 8:00 PM, the
            // end time will be set for 12:00 AM the next day. This causes the validation to pass even
            // if the form shows that the time range is too small.

            // Check if at least two time slots can fit in the time range.
            TimeSpan twoTimeSlotsSpan = TimeSpan.FromMinutes((int) numericUpDown.Value * 2);
            if (dtpEndTime.Value - dtpStartTime.Value < twoTimeSlotsSpan)
            {
                MessageBox.Show("The difference between the start and end time must provide for at least two time slots.", "Entry Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                dtpEndTime.Focus();
                return false;
            }

            return true;
        }
開發者ID:masonelmore,項目名稱:TicketQueue,代碼行數:28,代碼來源:Validator.cs

示例6: EIBDatePickerBase

        public EIBDatePickerBase()
        {
            dateTimePicker = new DateTimePicker();
            dateTimePicker.Size = new Size(width, height);

            //dateTimePicker.CalendarForeColor = Color.White;
            dateTimePicker.Dock = DockStyle.Top;
            this.Controls.Add(dateTimePicker);
            this.Resize += new System.EventHandler(EIBDatePickerBase_Resize);
            this.Size = new Size(width + 5, height + 5);
            this._Width = width;
            if (string.IsNullOrEmpty(this.Name))
            {
                this.Name = "datepicker" + counter;
            }
            if (string.IsNullOrEmpty(this.ControlName))
            {
                this.ControlName = this.Name;
            }
            checkUniqueness(this.Name);
            datapickerNames.Add(this.Name, this.Name);
            this.Margin = new Padding(0, 0, 0, 0);
            this.Font = SystemFonts.DefaultFont;
            this.Layout += new LayoutEventHandler(Control_Layout);
            this.SizeChanged += new System.EventHandler(Control_SizeChanged);
        }
開發者ID:harpreetoxyent,項目名稱:pnl,代碼行數:26,代碼來源:EIBDatePicker.cs

示例7: SelectCoDK

 /*Lấy ra dòng dữ liệu và gán vào các hộp text*/
 public void SelectCoDK(DChuyenBay DCB, TextEdit txtMaCB, ComboBoxEdit cbMaDB, ComboBoxEdit cbMaMB
                           , TimeEdit dtGioBay, TextEdit txtDiemDi, ComboBoxEdit cbDiemDen
                           , DateTimePicker dtNgayDi, DateTimePicker dtNgayDen, TextEdit txtVeL1,
                             TextEdit txtVeL2, TextEdit txtGhiChu)
 {
     try
     {
         string path = string.Format("Select * From ChuyenBay Where MaChuyenBay='{0}'", DCB.MCB);
         DataTable dtt = DA.TbView(path);
         txtMaCB.EditValue = dtt.Rows[0]["MaChuyenBay"].ToString().Trim();
         cbMaDB.EditValue = dtt.Rows[0]["MaDuongBay"].ToString().Trim();
         cbMaMB.EditValue = dtt.Rows[0]["MaMayBay"].ToString().Trim();
         dtGioBay.Text = dtt.Rows[0]["GioBay"].ToString().Trim();
         txtDiemDi.EditValue = dtt.Rows[0]["DiemDi"].ToString().Trim();
         cbDiemDen.EditValue = dtt.Rows[0]["DiemDen"].ToString().Trim();
         dtNgayDi.Text = dtt.Rows[0]["NgayDi"].ToString().Trim();
         dtNgayDen.Text = dtt.Rows[0]["NgayDen"].ToString().Trim();
         txtVeL1.EditValue = dtt.Rows[0]["SLV_Loai1"].ToString().Trim();
         txtVeL2.EditValue = dtt.Rows[0]["SLV_Loai2"].ToString().Trim();
         txtGhiChu.EditValue = dtt.Rows[0]["GhiChu"].ToString().Trim();
         //return dt.TbView(path);
     }
     catch
     {
         XtraMessageBox.Show("Vui lòng kích vào lưới thông tin chọn thông tin cần sửa !", "Chú ý !",
                                         MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
開發者ID:NguyenManh94,項目名稱:ManagerAirTicket,代碼行數:29,代碼來源:BChuyenBay.cs

示例8: ListarPordata

        public void ListarPordata(DataGridView dgv, string codigo, DateTimePicker dtp)
        {
            try
            {
                InstanciarBanco();
                dgv.DataSource = ((from mov in _banco.MovimentacaoProduto
                                   join prod in _banco.Produto on new { Codigo = mov.Codigo } equals new { Codigo = prod.Codigo }
                                   where prod.Codigo == codigo && mov.Data == dtp.Value.Date
                                   group new { mov, prod } by new
                                   {
                                       mov.Codigo,
                                       prod.Nome
                                   } into g
                                   select new
                                   {
                                       Código = g.Key.Codigo,
                                       Nome = g.Key.Nome,
                                       Quantidade = g.Sum(p => p.mov.Quantidade),
                                       Total = g.Sum(p => p.mov.Valor)
                                   }).Distinct()).ToList();

            }
            catch (CustomException error)
            {
                throw new CustomException(error.Message);
            }
            catch (Exception error)
            {
                throw new Exception(error.Message);
            }
        }
開發者ID:mikemajesty,項目名稱:Caixapadariav2,代碼行數:31,代碼來源:MovimentacaoProdutoRepositorio.cs

示例9: ConfigurationForm

        public ConfigurationForm()
        {
            InitializeComponent();

              settings.Load(settings.cXMLSectionUpdate);
              settings.Load(settings.cXMLSectionMusic);
              settings.Load(settings.cXMLSectionVideo);
              settings.Load(settings.cXMLSectionMisc);

              releaseVersion.Text = String.Format("Version: {0}", Assembly.GetExecutingAssembly().GetName().Version.ToString());
              DateTime buildDate = getLinkerTimeStamp(Assembly.GetExecutingAssembly().Location);
              compileTime.Text += " " + buildDate.ToString() + " GMT";

              timePicker = new DateTimePicker();
              timePicker.Format = DateTimePickerFormat.Time;
              timePicker.ShowUpDown = true;
              timePicker.Location = new Point(309, 85);
              timePicker.Width = 100;
              CheckUpdate.Controls.Add(timePicker);

              if (MiscConfigGUI.MostRecentFanartTimerInt != 0)
            numFanartTimer.Value = (decimal)MiscConfigGUI.MostRecentFanartTimerInt;
              else
            numFanartTimer.Value = 7;
        }
開發者ID:MichelZ,項目名稱:streamedmp-michelz,代碼行數:25,代碼來源:ConfigurationForm.cs

示例10: ListarEntreDatas

        public void ListarEntreDatas(DataGridView dgv, DateTimePicker dtpInicial, DateTimePicker dtpFinal)
        {
            try
            {
                InstanciarBanco();
                dgv.DataSource = ((from movimentacaoCaixa in _banco.MovimentacaoCaixa
                                   where movimentacaoCaixa.Data >= dtpInicial.Value.Date
                                       && movimentacaoCaixa.Data <= dtpFinal.Value.Date
                                   group movimentacaoCaixa by new
                                   {
                                       movimentacaoCaixa.Data
                                   } into g
                                   select new
                                   {
                                       Valor = g.Sum(p => p.Valor),
                                       Data = g.Key.Data
                                   }).Distinct()).ToList();

            }
            catch (CustomException erro)
            {
                throw new CustomException(erro.Message);
            }
            catch (Exception erro)
            {
                throw new Exception(erro.Message);
            }
        }
開發者ID:PablusVinii,項目名稱:Caixapadariav2,代碼行數:28,代碼來源:MovimentacaoCaixaRepositorio.cs

示例11: InitSpec

        protected void InitSpec(DateTimePicker box)
        {
            _Box = box;

            _MenuList = new Dictionary<string, ToolStripMenuItem>(15);
            InitMenu("yyyyMMdd", "yyyyMMdd", MuDate);
            InitMenu("yyyy-MM-dd", "yyyy-MM-dd", MuDate);
            InitMenu("yyyy/MM/dd", "yyyy/MM/dd", MuDate);
            InitMenu("yyyy.MM.dd", "yyyy.MM.dd", MuDate);
            InitMenu("yyyy年MM月dd日", "yyyy年MM月dd日", MuDate);

            InitMenu("HHmmss", "HHmmss", MuTime);
            InitMenu("HH:mm:ss", "HH:mm:ss", MuTime);
            InitMenu("HH時mm分ss秒", "HH時mm分ss秒", MuTime);
            InitMenu("H:m:s", "H:m:s", MuTime);
            InitMenu("H時m分s秒", "H時m分s秒", MuTime);
            InitMenu("h:m:s", "h:m:s", MuTime);
            InitMenu("h時m分s秒", "h時m分s秒", MuTime);

            InitMenu("yyyyMMdd HHmmss", "yyyyMMdd HHmmss", MuDateTime);
            InitMenu("yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm:ss", MuDateTime);
            InitMenu("yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm:ss", MuDateTime);
            InitMenu("yyyy年MM月dd日 HH時mm分ss秒", "yyyy年MM月dd日 HH時mm分ss秒", MuDateTime);

            _LastMenu = MiDateDef;
            _LastMenu.Checked = true;
        }
開發者ID:burstas,項目名稱:rmps,代碼行數:27,代碼來源:ADate.cs

示例12: selectDetails

        public void selectDetails(TextBox txt_Total, DateTimePicker startDatePicker, DateTimePicker endDatePicker)
        {
            var startDate = startDatePicker.Value.ToString("dd-MMM-yyyy");
            var endDate = endDatePicker.Value.ToString("dd-MMM-yyyy");

            string query_String = "SELECT SUM(Cost) FROM Bookings WHERE Return_Date BETWEEN'" + startDate + "'AND'" + endDate + "'";

            try
            {
                connection.Open();
                cmd = connection.CreateCommand();

                cmd.CommandText = query_String;
                data_reader = cmd.ExecuteReader();//the reader is used to read in the required record
                data_reader.Read();

                txt_Total.Text = data_reader.GetValue(0).ToString();

                connection.Close();
            }
            catch (Exception)
            {
                MessageBox.Show("No Records For the Chosen Period", "ERROR", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
            }
        }
開發者ID:pafennell,項目名稱:SoftwareEngineering,代碼行數:25,代碼來源:Account_Query.cs

示例13: Pagos

 public Pagos(string cuota,int codEmpresa)
 {
     this.codEmpresa=codEmpresa;
     InitializeComponent();
     this.lbTotalPago.Text = cuota;
     PagoMemDT = pago_MembresiaTableAdapter.GetDataByEmpresa(codEmpresa);
     //vistaPagos();
     PagoMemDT.Columns["perid_pago"].ColumnName = "Período de Pago";
     PagoMemDT.Columns["num_cuota"].ColumnName = "Número de Cuota";
     PagoMemDT.Columns["monto"].ColumnName = "Monto";
     PagoMemDT.Columns["fech_pago"].ColumnName = "Fecha de Pago";
     PagoMemDT.Columns["pagado"].ColumnName = "Estado";
     PagoMemDT.Columns["num_recib"].ColumnName = "Número de Recibo";
     PagoMemDT.Columns["observaciones"].ColumnName = "Observaciones";
     PagoMemDT.Columns["tipo"].ColumnName = "Tipo";
     this.dgPagosEmpresa.DataSource = PagoMemDT;
     this.domainNumCuotas.SelectedItem=5;
     dtpFechaPago = new DateTimePicker();
     dtpFechaPago.Format = DateTimePickerFormat.Short;
     dtpFechaPago.Visible = false;
     dtpFechaPago.Width = this.dgPagosEmpresa.Columns[5].Width-5;
     this.dgPagosEmpresa.Controls.Add(dtpFechaPago);
     this.dtpFechaPago.ValueChanged += dtpFechaPago_ValueChanged;
     this.dgPagosEmpresa.CellBeginEdit += this.dgPagosEmpresa_CellBeginEdit;
     this.dgPagosEmpresa.CellEndEdit += this.dgPagosEmpresa_CellEndEdit;
 }
開發者ID:eduardo-salazar,項目名稱:sag,代碼行數:26,代碼來源:Pagos.cs

示例14: EditValue

		public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
		{
			if (provider != null)
			{
				editorService = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
			}
			if (editorService != null)
			{
				if (value == null)
				{
					time = DateTime.Now.ToString("HH:mm");
				}

				DateTimePicker picker = new DateTimePicker();
				picker.Format = DateTimePickerFormat.Custom;
				picker.CustomFormat = "HH:mm";
				picker.ShowUpDown = true;

				if (value != null)
				{
					picker.Value = DateTime.Parse((string)value);
				}

				editorService.DropDownControl(picker);
				value = picker.Value.ToString("HH:mm");
			}
			return value;
		}
開發者ID:dodexahedron,項目名稱:EssentialsPlugin,代碼行數:28,代碼來源:UIEditors.cs

示例15: ListarPorDia

        public void ListarPorDia(DataGridView dgv, DateTimePicker dtp)
        {
            try
            {
                InstanciarBanco();
                dgv.DataSource = (from movimentacaoCaixa in
                                      (from mcaixa in _banco.MovimentacaoCaixa
                                       where mcaixa.Data == dtp.Value.Date
                                       select new
                                       {
                                           mcaixa.Valor,
                                           mcaixa.Data
                                       })
                                  group movimentacaoCaixa by new { movimentacaoCaixa.Data } into g
                                  select new
                                  {
                                      Valor = g.Sum(p => p.Valor),
                                      Data = g.Key.Data
                                  }).ToList();

            }
            catch (CustomException erro)
            {
                throw new CustomException(erro.Message);
            }
            catch (Exception erro)
            {
                throw new Exception(erro.Message);
            }

        }
開發者ID:mikemajesty,項目名稱:Caixapadariav2,代碼行數:31,代碼來源:MovimentacaoCaixaRepositorio.cs


注:本文中的System.Windows.Forms.DateTimePicker類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。