15,028,618 members
See more:
How to convert number like 40 to 0.4 in a textbox
Posted
Updated 17-Mar-21 11:28am
Sergey Alexandrovich Kryukov 14-Mar-14 13:15pm

Asking questions also requires some prerequisites. Not having successfully graduated from elementary school is not an option, sorry.
—SA
Mathiudi 14-Mar-14 13:25pm

Please don't be angry with me
Sergey Alexandrovich Kryukov 14-Mar-14 15:17pm

No, I'm not angry at all, why? hope you won't be angry, too. You need to learn by yourself and rely on yourself more.
Thank you for understanding.
—SA
Mathiudi 17-Mar-14 13:57pm

I'm a beginner and no one taught me how to use VB and VB.net. I learn by my self with help of files on vb.net and the rest I found on the internet. so some of the thing that stack me up, I have to ask for help.

## Solution 1

Divide the number by 100.

Maciej Los 14-Mar-14 17:06pm

:laugh:
The best answer i've ever seen ;)
[no name] 15-Mar-14 4:11am

This answer has been accepted? I'm with SA.

## Solution 2

Just parse the number in the textbox to a double and divide it by 100:
VB
```Dim value As String = textBox1.Text
Dim num As Double
If Double.TryParse(value, num) Then
Dim percentage As Double = num / 100
textBox2.Text = percentage.ToString()
Else
' cannot parse the given string to a double
End If```

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 Richard MacCutchan 165 Richard Deeming 155 CPallini 80 OriginalGriff 65 Wendelius 50
 OriginalGriff 2,084 Richard Deeming 1,393 Richard MacCutchan 1,077 CPallini 780 Dave Kreskowiak 481

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900