Overriding Text property of textbox

C

Chris

I wanted to display the "$" in front of a few currency textboxes. So I
thought this code would do the trick, and my Return
FormatCurrency(MyBase.Text) does run, but the textbox still shows the
unformatted text in the box. What am I doing wrong?

Chris

Public Overrides Property Text() As String
Get
Select Case m_Mask
Case Util.MaskType.Currency
If Not MyBase.Text Is Nothing AndAlso
MyBase.Text.Length > 0 Then
Return FormatCurrency(MyBase.Text)
End If
End Select
Return MyBase.Text
End Get
Set(ByVal Value As String)
Select Case m_Mask
Case Util.MaskType.Currency
If Not MyBase.Text Is Nothing AndAlso
MyBase.Text.Length > 0 Then
MyBase.Text = FormatCurrency(Value)
Return
End If
End Select
MyBase.Text = Value
End Set
End Property
 
C

Chris

Chris said:
I wanted to display the "$" in front of a few currency textboxes. So I
thought this code would do the trick, and my Return
FormatCurrency(MyBase.Text) does run, but the textbox still shows the
unformatted text in the box. What am I doing wrong?

Chris

Public Overrides Property Text() As String
Get
Select Case m_Mask
Case Util.MaskType.Currency
If Not MyBase.Text Is Nothing AndAlso
MyBase.Text.Length > 0 Then
Return FormatCurrency(MyBase.Text)
End If
End Select
Return MyBase.Text
End Get
Set(ByVal Value As String)
Select Case m_Mask
Case Util.MaskType.Currency
If Not MyBase.Text Is Nothing AndAlso
MyBase.Text.Length > 0 Then
MyBase.Text = FormatCurrency(Value)
Return
End If
End Select
MyBase.Text = Value
End Set
End Property


Please disregard because I missed something obvious and now will spend
the rest of the day feeling stupid.

the set should have been
if not Value is nothing andalso value.length > 0 then
.......

Thanks anyhow
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top