| | |
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 30minutes 2005 2008 access account arithmetic array basic bing button buttons center check code combobox component connectionstring crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dropdownlist excel fade file-dialog filter folder ftp generatetags google gridview hardcopy images input insert intel internet mobile monitor ms net networking objects output panel passingparameters peertopeervideostreaming picturebox picturebox1 port position print printing problem problemwithinstallation project save searchbox searchvb.net select serial shutdown soap survey table tcp temperature text textbox timer timespan toolbox trim update updown user vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf year





