Difference between revisions of "VB:Convert a String to a Number"

From Progzoo
Jump to: navigation, search
(String to int)
(String to int)
Line 4: Line 4:
 
Sub Main()
 
Sub Main()
 
   Dim s As String = "1234"
 
   Dim s As String = "1234"
   Console.WriteLine(i+1)
+
   Console.WriteLine(s+1)
 
End Sub
 
End Sub
 
End Module
 
End Module

Revision as of 12:29, 31 December 2007

String to int

The language will automatically convert the string to an integer as required.

The value "1234" is a string, you need to treat it as a number - to add 1, giving 1235.

[Font] [Default] [Show] [Resize] [History] [Profile]