资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

VB.net时间轴控件的简单介绍

VB.net中的DateTimePicker控件,使用valueChanged事件的问题

菜单:工具,部件

作为一家“创意+整合+营销”的成都网站建设机构,我们在业内良好的客户口碑。创新互联公司提供从前期的网站品牌分析策划、网站设计、做网站、成都网站建设、创意表现、网页制作、系统开发以及后续网站营销运营等一系列服务,帮助企业打造创新的互联网品牌经营模式与有效的网络营销方法,创造更大的价值。

把mcrosoft windows common controls-2 6.0(sp6)

得到的DTPicker就是DateTimePicker

MSDN,我手上没有也不知道,通常加控件还是通过部件加吧,不要直接加ocx太麻烦了。

VB.NET用TIMER控件

我使用Visual Basic 2008 编写

1、新建2个窗体Form1和Form2

2、Form1窗体新建一个Button按扭和一个Timer1控件

3、打开Form1编写如下代码

Public Class Form1

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Form2.Show()

Me.Hide() '隐藏本窗体

Timer1.Enabled = False '使其只执行1次

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Timer1.Enabled = True '能使用 其实这个在属性窗口中更容易设置

Timer1.Interval = 2000 '毫秒 即2秒

End Sub

End Class

如何使用VB.NET DateTimePicker控件

Visual Studio .NET的DateTimePicker控件为用户提供一个选择日期/时间的简便方法。这个控件允许你选择日期和时间;同时,由于这个控件允许你限制输入内容,你可以忽略合法的日期格式。DateTimePicker控件类似于MonthView控件,后者允许你选择一个日期或日期范围,但不支持时间选择。在本文中,我将创建一个使用DateTimePicker控件的实例。实例在常用控件(Common Controls)下的工具箱(Toolbox)中找到DateTimePicker控件,并把它添加到Windows Forms中。设置以下属性:l Name:dtpDateSelectionl CustomFormat:mm/dd/yyyyl Format:短l MaxDate:12/31/2008l MinDate:01/01/2007l ShowUpDown:假 在Form Load事件中添加以下代码: dtpDateSelection.Value = Now 创建以下事件: Private Sub dtpDateSelection_CloseUp(ByVal sender As Object, ByVal e As System.EventArgs) Handles dtpDateSelection.CloseUp MessageBox.Show(dtpDateSelection.Value) End Sub 结果在第一个例子中,ShowUpDown属性设为假,表示在用户点击控件时,控件的日历部分可见。然后用户从控件的日历部分选择日期。在DateTimePicker控件中选择一个日期后,你的屏幕看起来与图A类似。 现在,将ShowUpDown属性值改为真,再次运行代码。这次你不会看到控件的日历部分,你可以点击控件的上/下箭头来选择一个日期。其结果类似于图B。 注意,这个控件不允许你选择小于MinDate属性值或大于MaxDate属性值的日期。 更多信息你还可以使用许多其它属性和重要的方法,让DateTimePicker控件满足你的需求。MSDN提供关于如何使用DateTimePicker控件的其它细节。 Irina Medvinskaya自1996年开始涉足技术领域。她获得佩斯大学的MBA学位,现在任花旗集团的项目经理。

VB.NET,如何用TIMER控件计时

这种功能用不到TIMER,TIMER控件用在这种地方也不适合。(假如你所统计的时间很短,在几分中内话,可以使用,假如你统计的时间很长:几小时、几天几夜,建议改用以下方式):

在你需要开始计时的地方加入一个记录当前时间,在你想结束的地方也得到一个当前时间。然后将两个时间相减。

希望以上思路可以帮到你。

vb.net中datetimepicker控件的时间格式问题

还要设置Format 为 : Custom

用的时候用DateTimePicker1.Text 不要用value

下面是我随便用了两个DateTimePicker和一个button一个textbox演示了一下的代码,你根据自己的需要调试DateTimePicker风格

------------------------------------------------

Public Class Form1

Inherits System.Windows.Forms.Form

#Region

Public Sub New()

MyBase.New()

InitializeComponent()

End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

If disposing Then

If Not (components Is Nothing) Then

components.Dispose()

End If

End If

MyBase.Dispose(disposing)

End Sub

Private components As System.ComponentModel.IContainer

Friend WithEvents DateTimePicker1 As System.Windows.Forms.DateTimePicker

Friend WithEvents Button1 As System.Windows.Forms.Button

Friend WithEvents TextBox1 As System.Windows.Forms.TextBox

Friend WithEvents DateTimePicker2 As System.Windows.Forms.DateTimePicker

System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()

Me.DateTimePicker1 = New System.Windows.Forms.DateTimePicker

Me.Button1 = New System.Windows.Forms.Button

Me.TextBox1 = New System.Windows.Forms.TextBox

Me.DateTimePicker2 = New System.Windows.Forms.DateTimePicker

Me.SuspendLayout()

'

'DateTimePicker1

'

Me.DateTimePicker1.AllowDrop = True

Me.DateTimePicker1.CustomFormat = "yyyy-MM-dd"

Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom

Me.DateTimePicker1.Location = New System.Drawing.Point(56, 24)

Me.DateTimePicker1.Name = "DateTimePicker1"

Me.DateTimePicker1.ShowUpDown = True

Me.DateTimePicker1.Size = New System.Drawing.Size(160, 19)

Me.DateTimePicker1.TabIndex = 0

'

'Button1

'

Me.Button1.Location = New System.Drawing.Point(144, 128)

Me.Button1.Name = "Button1"

Me.Button1.TabIndex = 1

Me.Button1.Text = "Button1"

'

'TextBox1

'

Me.TextBox1.Location = New System.Drawing.Point(136, 72)

Me.TextBox1.Name = "TextBox1"

Me.TextBox1.TabIndex = 2

Me.TextBox1.Text = "TextBox1"

'

'DateTimePicker2

'

Me.DateTimePicker2.CustomFormat = "yyyy-MM-dd"

Me.DateTimePicker2.Format = System.Windows.Forms.DateTimePickerFormat.Custom

Me.DateTimePicker2.Location = New System.Drawing.Point(40, 160)

Me.DateTimePicker2.Name = "DateTimePicker2"

Me.DateTimePicker2.Size = New System.Drawing.Size(120, 19)

Me.DateTimePicker2.TabIndex = 3

'

'Form1

'

Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)

Me.ClientSize = New System.Drawing.Size(292, 273)

Me.Controls.Add(Me.DateTimePicker2)

Me.Controls.Add(Me.TextBox1)

Me.Controls.Add(Me.Button1)

Me.Controls.Add(Me.DateTimePicker1)

Me.Name = "Form1"

Me.Text = "Form1"

Me.ResumeLayout(False)

End Sub

#End Region

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

TextBox1.Text = DateTimePicker1.Text

End Sub

End Class

----------------------------------------------------------

我的操作系统和.net都是日文的,注释的东西我删除了,主要看代码就好了

这段代码你可以建一个空的解决方案,完全复制到里面去


文章标题:VB.net时间轴控件的简单介绍
本文地址:http://cdkjz.cn/article/hdppgs.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220