Foxtable(狐表)用户栏目专家坐堂 → 如何及时更新时间


  共有3965人关注过本帖平板打印复制链接

主题:如何及时更新时间

帅哥哟,离线,有人找我吗?
ap9709130
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:六尾狐 帖子:1467 积分:11418 威望:0 精华:0 注册:2013/11/24 22:10:00
如何及时更新时间  发帖心情 Post By:2014/2/10 22:49:00 [只看该作者]

我的输入窗口中有个COMBOBOX控件和DATETIMEPICKER控件,我想根据combobox选的选项,DATETIMEPICKER时时生成新的时间。

我在COMBOBOX控件的 VALUECHANGE 事件中输入以下代码:

 

Dim a As WinForm.ComboBox = e.Form.Controls("ComboBox3")
Dim b As WinForm.DateTimePicker = e.Form.Controls("DateTimePicker1")

If a.Value="现金" Then
b.Value = Date.Today
End If

If a.Value= "月结" Then
Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month

Dim dt2 As New Date(y, m, Date.DaysInMonth(y, m)) '获取本月的最后一天

b.Value = dt2
 
End If

If a.Value= "月结30天" Then
Dim y As Integer = Date.Today.Year
Dim m As Integer = Date.Today.Month

Dim dt3 As New Date(y, m+1, Date.DaysInMonth(y, m+1)) '获取本月的最后一天

b.Value = dt3
 
End If

 

 

为什么选现金时,可以时时更新,而且选了后面这两个不会马上更新时间,但窗口重新打开时,时间又会显示出来,如果可以实现先后面这两个时间也能马上显示出来呢?


 回到顶部