Question DatePicker acting weird

Kevin McKowski

New member
Joined
Aug 2, 2011
Messages
1
Location
Cambridge, Massachusetts, United States
Programming Experience
3-5
Hi,

I'm using the DatePicker control, and it's been acting up! No matter what date I select, it always returns todays date!
Here's the code below:

VB.NET:
        Private Sub cmdOK_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles cmdOK.Click


            MessageBox.Show(dtpDueDate.DisplayDate()) ' Always shows Todays date! (No matter what date I pick)
            Close() ' Close the window


        End Sub

I'm stumped .. Anyone seen this before? (Screenshot attached) Untitled.png
 
First up, yours is a WPF application, not WinForms, so I have moved this thread to the appropriate forum.

As for the problem, you should start by reading the appropriate documentation. The DisplayDate relates to the calendar part of the DatePicker only. What you want is the SelectedDate.
 
Back
Top