Displaying the output to two decimal places was easy enough to figure out, I just used:
But I'm completely stuck on the other part however and I'm wondering if anyone here has any suggestions. I thought about doing something like this:
Dim m, n As Integer Dim decStr As String m = txtInput.IndexOf(".") 'to find the position of the decimal point n = txtInput.IndexOf(" ") 'to find the position of the space decStr = txtInput.Substring(m, n)
Now this code unfortunately doesn't work at all (lol), but its the only idea I have right now. Basically I'm looking to find a way to figure out what position the decimal point is at and what position the space is at, take the substring of that, figure out the length of the substring and then use that integer value in the FormatNumber function for the output.
Then once that's done I'll just an If block to switch between the default two decimal places and the input decimal places.
So if anyone has any tips or feedback or alternative ideas I'd really appreciate the help.