473,383 Members | 1,980 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,383 software developers and data experts.

Displaying 2DP in textboxes

Hi All

When I retrieve this data into standard text boxes (using ASP/ADO) so that
the user can update/file the following problems occur on what I would call
price fields:

10 << I want 10.00

11.6 << I want 11.60

12.89 << this is fine

My MySQL DB holds prices as decimal(10,3) so I know the decimal data isn't
chopped at this point.

Before the data is displayed in these boxes I created the below function to
parse the data before it is written to the boxes:

eg, s can equal 10 or 11.2 or 12.89 .... etc....even Fred, Steve, etc

Function ReFormatIfNum(s)
dim decNumTest
decNumTest = MID(s,1,InStr(s,"."))
IF LEN(decNumTest) = 0 THEN decNumTest = s
IF IsNumeric(decNumTest) THEN
s = FormatNumber(s)
s = Replace(s,",","")
END IF
ReFormatIfNum = s
End Function

This seems to coveer 10.5's, 12.3's etc (ie 1 DP missing), but prices with
no DPs (eg 10, 8, etc) don't get past the IsNumeric test. How come?

I thought the above would be water-tight for these, but I can't get the no
DPs to show 2 DPs.

Please note that I pass string based data through this function on a generic
loop as I'm trying to make this as automated as possible.

Do you have any idea as to what I'm doing wrong?

Thanks

Laphan
Jul 19 '05 #1
0 958

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

Similar topics

6
by: stephan.vanbeerschoten | last post by:
Hi All, I am relatively new to MS Access but am wel suited in general relational databases. I seem to be unable to accomplish the displaying of query results that return more then one line item....
2
by: Raghavendra V | last post by:
Hi all, I have a datagrid and textboxes as columns. But when i say the textbox property as PASSWORD the * (stars) does not display in the password text box at runtime. But when it is a normal...
3
by: Schapopa | last post by:
Hello, I have form where I want to display data from one record. So I created stored procedure with parameter and I populated some dropdown boxes with data, and now I would like to display that...
2
by: David Scemama | last post by:
Hi, I'm looking for a way to display semi graphic characters in a multi line text control or in a rich text control. I've tried with all the characters of the extended ASCII table (code page...
0
by: jagadeesh narra | last post by:
Hi, Based on drop down value,i need to create textboxes in the same page.I should execute it in "onchange" event. Thanks Jagadeesh
2
by: technocraze | last post by:
Hi community experts, I am encountering a problem to display the corresponding values of the combo box into the textboxes. I have chose option 1 & 3 for this implementation but neither is working....
5
by: salo | last post by:
hi... can anybody help me for displaying only alphabets in textboxes in visual studio 2005 i gave in validation expression for regular expression validation...... but still im not getting ....if i...
0
by: Matthew87 | last post by:
Hi all I'm having a bit of trouble completeing my coursework basically so far i have created Citenary class with support methods for a private array. The problem is i can add objects to the array...
1
by: seadog | last post by:
Hi, I am having a problem displaying data in a textbox array. What I am trying to do is have 5 number enter 5 textboxes, starting from the first and working there way to the bottom textbox. What...
1
by: srinuvasteegala | last post by:
i wrote a javascript for displaying textboxes when i enter a number in a texbox. now i want to insert some data in those textboxes and save the data in backend and display the same in a grid
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.