Click here to Skip to main content
15,037,388 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
How to convert number like 40 to 0.4 in a textbox
Posted
Updated 17-Mar-21 11:28am
Comments
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.

Divide the number by 100.

What's so hard about this?
   
Comments
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.
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)




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