4
如何檢查DateTimePicker的月份箭頭單擊事件。當我試圖更改datetimepicker的月份時,它會給出下個月的第一個日期,所以我必須防止該月份的點擊。獲取月份點擊Datetimepicker vb.net
請參閱圖像
非常感謝。
如何檢查DateTimePicker的月份箭頭單擊事件。當我試圖更改datetimepicker的月份時,它會給出下個月的第一個日期,所以我必須防止該月份的點擊。獲取月份點擊Datetimepicker vb.net
請參閱圖像
非常感謝。
混合特寫和下拉事件的使用情況和綁定數據可能是解決
Imports System.Windows.Forms
Namespace WindowsFormsApplication1
Public Partial Class Form1
Inherits Form
Private isDropedDown As Boolean
Private m_dataSale As DateTime = DateTime.Now
Public Property DataSale() As DateTime
Get
Return m_dataSale
End Get
Set
If isDropedDown Then
If m_dataSale.[Date].AddMonths(1).[Date] = value.[Date] OrElse m_dataSale.[Date].AddMonths(-1).[Date] = value.[Date] OrElse New DateTime(m_dataSale.Year, m_dataSale.Month, 1).AddMonths(1).[Date] = value.[Date] OrElse New DateTime(m_dataSale.Year, m_dataSale.Month, 1).AddMonths(-1).[Date] = value.[Date] Then
MessageBox.Show("Month is changing")
End If
End If
m_dataSale = value
End Set
End Property
Public Sub New()
InitializeComponent()
Dim binding = dateTimePicker1.DataBindings.Add("Value", Me, "DataSale")
binding.DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged
End Sub
Private Sub dateTimePicker1_CloseUp(sender As Object, e As EventArgs)
isDropedDown = False
End Sub
Private Sub dateTimePicker1_DropDown(sender As Object, e As EventArgs)
isDropedDown = True
End Sub
End Class
End Namespace
嗨,我現在處理的DateTimePicker的ValueChanged事件,但它是在兩個時間致電(即當我們點擊在具體的日期和時間箭頭點擊)所以我的問題是,我如何認識月箭頭點擊datetimepicker,因爲在這兩個時間值更改被稱爲。 – 2013-02-23 06:54:05
@Rahul Shirphule我已經改變了答案pal – 2013-02-23 10:35:42
是的,這是工作謝謝...! – 2013-02-25 08:47:48