|
-
Jan 19th, 2017, 12:44 AM
#1
Thread Starter
Lively Member
Decimal placement more than 3 digits?
Hello, I am making this application and I need the decimal placement to go past 3 digits after the decimal is placed. I would do double but that seems to mess the program up with unwanted digits. I am different radio button options like tenths place, hundreths place, etc... all the way to millionths. It will go to thousandths and that is where it is lastly effective before it can not go up anymore numbers anymore. Replies are appreciated, thanks!
-
Jan 19th, 2017, 01:04 AM
#2
Hyperactive Member
Re: Decimal placement more than 3 digits?
try
format(txtdata.text,"0##.00")
for reference if it is useful
-
Jan 19th, 2017, 01:10 AM
#3
Fanatic Member
Re: Decimal placement more than 3 digits?
Hello, I am making this application and I need the decimal placement to go past 3 digits after the decimal is placed.
You question is pretty unclear, so I reckon that you just need proper format for your numbers:
Code:
Dim value As Integer = 1234567891
MsgBox(value.ToString("N0") 'zero and not "O" character
'Result is 1.234.567.891
'Or Msgbox(value.ToString("N3")) - result is 1.234.567.891,000
You can use Double too. And you might a look at this for future formats:
https://msdn.microsoft.com/en-us/lib...code-snippet-1
-
Jan 19th, 2017, 11:12 AM
#4
Re: Decimal placement more than 3 digits?
1) yes, don't use the double... use the Decimal type...
2) Don't confuse the value with the display...
3) since you haven't shown any code, I'm not sure what the issue is... so, refer back to item 1 in this list.
-tg
-
Jan 19th, 2017, 06:22 PM
#5
Thread Starter
Lively Member
Re: Decimal placement more than 3 digits?
Alright, somewhat what I want. It stops at 0.001 but I need it to go as far as 0.00001
-
Jan 19th, 2017, 07:32 PM
#6
Re: Decimal placement more than 3 digits?
What do you meant "Stops"? Keep in mind, we haven't the foggiest idea what you're doing since you haven't shown what code you're using.
-tg
-
Jan 19th, 2017, 11:22 PM
#7
Thread Starter
Lively Member
Re: Decimal placement more than 3 digits?
What I mean is this: I have 6 Options. Tenths, Hundredths, Thousandths, Ten-Hundredths, Ten-Thousandths, and Millionths. The format for Thousandths is 0.001 and when I try millionths it should be 0.000001 but the displayed format is 0.001
Here is some code:
Code:
Sub Millionths()
startNum = txtStart.Text
EndNum = txtEnd.Text
While (startNum >= EndNum + 0.000001)
counter += 1
startNum -= 0.001
Data += startNum & vbNewLine
End While
starting = txtStart.Text
rtbDisplay.Text = starting & vbNewLine & Data & vbNewLine
lblCount.Text = counter
End Sub
Declares(At start of program):
Code:
Dim startNum, starting As Decimal
Dim EndNum As Decimal
Dim Data As String
Dim counter As Integer = 0
Last edited by Dragnorian; Jan 19th, 2017 at 11:22 PM.
Reason: Added Code
-
Jan 19th, 2017, 11:48 PM
#8
Re: Decimal placement more than 3 digits?
You already have all the information you need from post #3. Did you follow the link provided there?
-
Jan 20th, 2017, 12:01 AM
#9
Thread Starter
Lively Member
Re: Decimal placement more than 3 digits?
Oh I didn't even notice that link lol, I will look at in a bit. Thanks for pointing that out!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|