VB Convert String to Number Guide

To convert a string to a number, you can use the Convert.ToInt32() method to convert the string to an integer, or use the Convert.ToDouble() method to convert the string to a floating point number. For example:

Dim str As String = "123"
Dim num As Integer = Convert.ToInt32(str)
Console.WriteLine(num) ' 输出:123

Dim str2 As String = "3.14"
Dim num2 As Double = Convert.ToDouble(str2)
Console.WriteLine(num2) ' 输出:3.14
bannerAds