Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How to convert the percentage entered in the text box into a double-precision value in vb 2005
How to convert the percentage entered in the text box into a double-precision value in vb 2005
This is very simple

Method 1:

Put a label in the text box and change it to% mark, which is the easiest!

Method 2:

Don't hit the percent sign, just do it.

Create a new textbox 1.

Label 1 is used to display the answer.

A button

Just put the following code in the button.

Dim b and c are decimal.

Mark x and y as strings.

Mark l as an integer

x = TextBox 1。 text

L = X. Length-1

y = x.Substring(0,L)

c = CDec(y) / CDec( 100)

b = c * CDec(2.6)

Label 1。 Text = b.ToString()