| | |
add a decimal point
Please support our VB.NET advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Dec 2002
Posts: 461
Reputation:
Solved Threads: 56
If it is always .xx then divide by 100.
As shown 8.99 would be put in the text box.
But if num = 899.1 then 899.1 would be put in the textbox.
Problem is 899.0 will be returned as 8.99 because the conversion to string removes the .0 so no dot is in the string.
VB.NET Syntax (Toggle Plain Text)
Dim num As Decimal = 899 Dim s As String = CStr(num) If s.IndexOf(".") < 0 Then TextBox1.Text = (num / 100D).ToString End If
As shown 8.99 would be put in the text box.
But if num = 899.1 then 899.1 would be put in the textbox.
Problem is 899.0 will be returned as 8.99 because the conversion to string removes the .0 so no dot is in the string.
Last edited by waynespangler; Mar 23rd, 2009 at 12:42 pm.
Wayne
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
It is hard to understand how a cemetery can raise its burial rates and blame it on the cost of living.
•
•
Join Date: May 2008
Posts: 13
Reputation:
Solved Threads: 0
•
•
•
•
If it is always .xx then divide by 100.
VB.NET Syntax (Toggle Plain Text)
Dim num As Decimal = 899 Dim s As String = CStr(num) If s.IndexOf(".") < 0 Then TextBox1.Text = (num / 100D).ToString End If
As shown 8.99 would be put in the text box.
But if num = 899.1 then 899.1 would be put in the textbox.
Problem is 899.0 will be returned as 8.99 because the conversion to string removes the .0 so no dot is in the string.
thanx wayne my main problem is that it may not always be 899 as it is scales the data is continuly changing (any ideas) thanx again
stephen
![]() |
Similar Threads
- if statemetn (C++)
- modifying text file (Python)
- Working with COleDateTime variable (C)
- Java Swing Calculator program not running. It has 0 errors (Java)
- Cannot resolve symbol (Java)
- remove decimal point from currency value else add 00 to the end (HTML and CSS)
Other Threads in the VB.NET Forum
- Previous Thread: utility computing
- Next Thread: Understanding the BackgroundWorker Process
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms ftp generatetags html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey table temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





