C
Co
Hi All,
I created a DateTimePicker to use on my form when I doubleclick a
textbox.
The problem is that I can't remove it when I used it.
Dim WithEvents m_picker As DateTimePicker
Private Sub CreateDTP()
m_picker = New DateTimePicker
m_picker.Format = DateTimePickerFormat.Short
m_picker.Location = tbVerloopt.Location
m_picker.Size = tbVerloopt.Size
m_picker.CalendarMonthBackground = Color.Beige
tbVerloopt.Parent.Controls.Add(m_picker)
End Sub
Private Sub OnValueChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles m_picker.ValueChanged
Try
tbVerloopt.Text = m_picker.Value.ToShortDateString()
Catch oException As Exception
MessageBox.Show(oException.Message)
End Try
End Sub
Private Sub DropDownDTP(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles m_picker.DropDown
End Sub
Private Sub CloseUpDTP(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles m_picker.CloseUp
Me.Controls.Remove(m_picker)
m_picker = Nothing
End Sub
The ClosUpDTP isn't working and the DTP stays visible.
Marco
I created a DateTimePicker to use on my form when I doubleclick a
textbox.
The problem is that I can't remove it when I used it.
Dim WithEvents m_picker As DateTimePicker
Private Sub CreateDTP()
m_picker = New DateTimePicker
m_picker.Format = DateTimePickerFormat.Short
m_picker.Location = tbVerloopt.Location
m_picker.Size = tbVerloopt.Size
m_picker.CalendarMonthBackground = Color.Beige
tbVerloopt.Parent.Controls.Add(m_picker)
End Sub
Private Sub OnValueChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles m_picker.ValueChanged
Try
tbVerloopt.Text = m_picker.Value.ToShortDateString()
Catch oException As Exception
MessageBox.Show(oException.Message)
End Try
End Sub
Private Sub DropDownDTP(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles m_picker.DropDown
End Sub
Private Sub CloseUpDTP(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles m_picker.CloseUp
Me.Controls.Remove(m_picker)
m_picker = Nothing
End Sub
The ClosUpDTP isn't working and the DTP stays visible.
Marco