473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Overriding Text property of textbox

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
Nov 21 '05 #1
1 4782
Chris wrote:
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
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Edward Diener | last post by:
Is it possible for a derived class to override a property and/or event of its base class ?
3
by: PawelR | last post by:
Hi, I use dataGrid to show data from DataBase. In one table I've text field (varchar 2048) and data in this field is very long (more characters). How show this text in datagrid as multiline or...
1
by: Morten Plathe | last post by:
Hi, Is there a way to override the shadowed (grey) backcolor of a textbox when the textbox is disabled for input (textbox.enabled = false) ? In some cases I want to have a custom backcolor when...
1
by: Martin | last post by:
Dear Group Sorry for bothering you again but I need expert advice on this. I have placed a HTML textbox on my aspx form and converted it to run as a server control. At some point in my code I...
4
by: Phill. W | last post by:
Here's a knotty little problem. I have some nasty little controls that needs to behave in a non- windows-Standard way - don't ask why; it's a large application being converted from some older...
5
by: DCSTech | last post by:
On my webpage I have a textbox. I would like to be able to change the text in the textbox and via a pushbutton have the value in the textbox written to the .text property so that next time the...
11
by: Ron L | last post by:
I have a barcode scanner which uses a "keyboard wedge" program so that the data it scans comes through as if it was typed on a keyboard. I am trying to have the data in the barcode be displayed in...
31
by: Kathy | last post by:
I would like to get the old and new value for a change made to a text box so that I can store them in a change history table. What is the best way to do this? I am just learning VB 2005; porting...
18
by: Academia | last post by:
I let the use modify the text of a combobox and then I replace the selected item with the new text (in Keyup event). But if he sets the Text property to an empty string ("") that sets the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.