使用月历的问题 [英] problem using monthcalendar
本文介绍了使用月历的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在单击文本框时,我在表单中弹出了一个日历.但是我无法使用日历的上一个/下一个"按钮进行导航(即更改月份).这是设置问题吗?请建议.....
代码如下:
私有 子 labrefdt_KeyPress( ByVal 发件人 As 对象, ByVal As System.Windows.Forms.KeyPressEventArgs)句柄 labrefdt.KeyPress
如果 Asc(e.KeyChar)=键.请输入然后
如果 Len(labrefdt.Text)= 0 >然后跨度>
labrefdt.Enabled = 错误
selcalendar.Show()
selcalendar.Focus()
selcalendar.ShowTodayCircle = 真
selcalendar.ScrollChange = 1
其他
labrefdt.Enabled = 错误
labrefdt.Text = Format(" )
GroupBox2.Enabled = 真
patname.Enabled = 正确
patadd.Enabled = 真实
patsex.Visible = 错误
malebutton.Visible = 真
femalebutton.Visible = 真
patname.Text = "
patname.Focus()
patcontact.Enabled = 真实
patreference.Enabled = 真实
结束 如果
结束 如果
结束 子
还有如何将日历中的选定日期放入文本框中.当前形式的子级?如果它是一个单独的对话框,它将具有ShowDialog方法,您应该调用ShowDialog方法,以使表格具有模式性.
On clicking a text box, I have pop-upped a calendar within a form. But I am not able navigate (i.e. change the months) by using the Previous/Next buttons of the calendar. Is this a setup problem ? Please suggest.....
the code is as follows :
Private Sub labrefdt_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles labrefdt.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
If Len(labrefdt.Text) = 0 Then
labrefdt.Enabled = False
selcalendar.Show()
selcalendar.Focus()
selcalendar.ShowTodayCircle = True
selcalendar.ScrollChange = 1
Else
labrefdt.Enabled = False
labrefdt.Text = Format("dd/MM/yyyy")
GroupBox2.Enabled = True
patname.Enabled = True
patadd.Enabled = True
patsex.Visible = False
malebutton.Visible = True
femalebutton.Visible = True
patname.Text = ""
patname.Focus()
patcontact.Enabled = True
patreference.Enabled = True
End If
End If
End Sub
Also how to put the selected date from the calendar into a text box.
解决方案
I don''t see any reason for this not to work, but is selcalendar a child of the current form ? If it''s a seperate dialog, it will have a ShowDialog method, which you should call instead to make the form modal.
这篇关于使用月历的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文