This is baffling me!!
I have created the following class :-
Public Class DateTextBox
Inherits System.Windows.Forms.TextBox
Private strTempText As String = " / / "
Public Sub New()
MyBase.New()
End Sub
<DefaultValue(" / / "> Public Overrides Property Text() As String
Get
Return strTempText
End Get
Set(ByVal Value As String)
strTempText = Value
End Set
End Property
So, when I add the control into my toolbox I can place any date related textbox on to the form and not have to mess around with it at all. But it does not appear to work! For a start, the text property automatically gets filled with "DateTextBox1" and then when you reset the property to its default it displays correctly in the properties window as " / / " but the control itself is blank. Then, if you run the form the textbox is still blank.
Many thanks.
Glyn.
I have created the following class :-
Public Class DateTextBox
Inherits System.Windows.Forms.TextBox
Private strTempText As String = " / / "
Public Sub New()
MyBase.New()
End Sub
<DefaultValue(" / / "> Public Overrides Property Text() As String
Get
Return strTempText
End Get
Set(ByVal Value As String)
strTempText = Value
End Set
End Property
So, when I add the control into my toolbox I can place any date related textbox on to the form and not have to mess around with it at all. But it does not appear to work! For a start, the text property automatically gets filled with "DateTextBox1" and then when you reset the property to its default it displays correctly in the properties window as " / / " but the control itself is blank. Then, if you run the form the textbox is still blank.
Many thanks.
Glyn.