PC Review


Reply
Thread Tools Rate Thread

how to remove a programmatically created DateTimePicker

 
 
Co
Guest
Posts: n/a
 
      14th May 2009
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
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How Do I set the Value of a DateTimePicker Programmatically? Manuel Canas Microsoft VB .NET 13 25th May 2012 08:56 AM
how to remove a programmatically created DateTimePicker Co Microsoft VB .NET 38 15th May 2009 05:09 PM
Remove multiple programmatically created controls hunanwarrior@gmail.com Microsoft VB .NET 8 2nd Feb 2007 01:35 PM
Data from Programmatically created Excel into SQL Server =?Utf-8?B?UmFq?= Microsoft Excel Programming 0 20th Jan 2005 11:03 PM
DateTimePicker closing up calendar control programmatically Shravan Microsoft C# .NET 1 27th Oct 2003 11:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:39 PM.