commas in text fields to save as a numeric value

  • Thread starter Thread starter Dan
  • Start date Start date
D

Dan

I have a financial application.

When I populate text boxes with financial numbers I don't group the digits via a comma.

For example. I'll use 500000 instead of 500,000.

Obviously the latter is easier to read by our accounting guys.

The problem is when saving 500,000. It will save 500 because I save the Val(txtTextBox.Text) value. Val cuts off the number at the first non numeric character.

Is there anyway to change the .Text functionality in some of my text boxes without having to create my own user control or web control. I'd just like to override the way it handles retrieving numeric data (with $ and commas) from a text box. Basically if the text value is $500,000, I'd like the text property to return 500000

Anyone have any ideas?

I am using ASP.NET Framework 1.1.

Perhaps I could override the text property in all my textboxes easily?

???
 
..Text will return everything that is contained in it. What is "Val" - is that some method you're using to parse the text as? Can you post the code for it?

Matt Hawley, MCAD .NET
http://www.eworldui.net

I have a financial application. When I populate text boxes with financial numbers I don't group the digits via a comma. For example. I'll use 500000 instead of 500,000. Obviously the latter is easier to read by our accounting guys. The problem is when saving 500,000. It will save 500 because I save the Val(txtTextBox.Text) value. Val cuts off the number at the first non numeric character. Is there anyway to change the .Text functionality in some of my text boxes without having to create my own user control or web control. I'd just like to override the way it handles retrieving numeric data (with $ and commas) from a text box. Basically if the text value is $500,000, I'd like the text property to return 500000 Anyone have any ideas? I am using ASP.NET Framework 1.1. Perhaps I could override the text property in all my textboxes easily? ??? This post contained attachments. By default, NewsGator will not download attachments, but can be configured to do so. If you wish to automatically download attachments for this newsgroup, go to NewsGator/Subscriptions, select this group and click Edit, and change the Options.


[microsoft.public.dotnet.framework.aspnet.webcontrols]
 
Text will return everything that is contained in it.

Thats exactly what I dont want.

Val is a VB function that converts a string to a numeric. Look it up in
help for more information
Matt Hawley, MCAD .NET
http://www.eworldui.net

I have a financial application. When I populate text boxes with
financial numbers I don't group the digits via a comma. For example. I'll
use 500000 instead of 500,000. Obviously the latter is easier to read by
our accounting guys. The problem is when saving 500,000. It will save 500
because I save the Val(txtTextBox.Text) value. Val cuts off the number at
the first non numeric character. Is there anyway to change the .Text
functionality in some of my text boxes without having to create my own user
control or web control. I'd just like to override the way it handles
retrieving numeric data (with $ and commas) from a text box. Basically if
the text value is $500,000, I'd like the text property to return 500000
Anyone have any ideas? I am using ASP.NET Framework 1.1. Perhaps I could
override the text property in all my textboxes easily? ??? This post
contained attachments. By default, NewsGator will not download attachments,
but can be configured to do so. If you wish to automatically download
attachments for this newsgroup, go to NewsGator/Subscriptions, select this
group and click Edit, and change the Options.
[microsoft.public.dotnet.framework.aspnet.webcontrols]
 
Okay,

Try using Val(txtTextBox.Text.Replace(",", "")) then.

Matt Hawley, MCAD .NET
http://www.eworldui.net

Text will return everything that is contained in it.

Thats exactly what I dont want.

Val is a VB function that converts a string to a numeric. Look it up in
help for more information
Matt Hawley, MCAD .NET
http://www.eworldui.net

I have a financial application. When I populate text boxes with
financial numbers I don't group the digits via a comma. For example. I'll
use 500000 instead of 500,000. Obviously the latter is easier to read by
our accounting guys. The problem is when saving 500,000. It will save 500
because I save the Val(txtTextBox.Text) value. Val cuts off the number at
the first non numeric character. Is there anyway to change the .Text
functionality in some of my text boxes without having to create my own user
control or web control. I'd just like to override the way it handles
retrieving numeric data (with $ and commas) from a text box. Basically if
the text value is $500,000, I'd like the text property to return 500000
Anyone have any ideas? I am using ASP.NET Framework 1.1. Perhaps I could
override the text property in all my textboxes easily? ??? This post
contained attachments. By default, NewsGator will not download attachments,
but can be configured to do so. If you wish to automatically download
attachments for this newsgroup, go to NewsGator/Subscriptions, select this
group and click Edit, and change the Options.
[microsoft.public.dotnet.framework.aspnet.webcontrols]



[microsoft.public.dotnet.framework.aspnet]
 
Try CDbl() or Double.Parse, or some other similar method :)

Mythran

I have a financial application.

When I populate text boxes with financial numbers I don't group the digits via
a comma.

For example. I'll use 500000 instead of 500,000.

Obviously the latter is easier to read by our accounting guys.

The problem is when saving 500,000. It will save 500 because I save the
Val(txtTextBox.Text) value. Val cuts off the number at the first non numeric
character.

Is there anyway to change the .Text functionality in some of my text boxes
without having to create my own user control or web control. I'd just like to
override the way it handles retrieving numeric data (with $ and commas) from a
text box. Basically if the text value is $500,000, I'd like the text property to
return 500000

Anyone have any ideas?

I am using ASP.NET Framework 1.1.

Perhaps I could override the text property in all my textboxes easily?

???
 
Back
Top