From the course: Visual Basic Essential Training
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Convert and parse string to numbers - Visual Basic Tutorial
From the course: Visual Basic Essential Training
Convert and parse string to numbers
- [Instructor] The parse method is one of the best ways to turn string values into numeric values. It is part of the .NET classes, and you should know how to use it and TryParse. Having said that, it's also good to know that the default conversions, or implicit conversions available from VB will suffice in many situations. For this example, I have these two variables, and integer, and a double, I will set their values using the parse method on line 11, and then I'll output their values to the application, so right now it looks like this. I'm not parsing anything, so I've got a value of zero. Where I will get the information is from this text box, so the user can type in any value here, and then click on this Parse to Number and we should see the results. That text box is over here on the main window, it's here, and the name of that is InputTextBox. I can write code like this, go to the InputTextBox, get the text property,…
Contents
-
-
-
-
-
-
-
-
-
Work with variables and constants4m 56s
-
Use the Code Explorer project1m 59s
-
Declare a variable6m 30s
-
Tips to make literals pop in the editor2m 34s
-
Work with custom and built-in constants3m 54s
-
Understand variable scope5m 42s
-
Understand numeric to numeric conversions5m 54s
-
Convert numeric values5m 43s
-
Convert and format numbers to string6m 39s
-
Convert and parse string to numbers5m 59s
-
Work with strings7m 11s
-
Work with dates and times9m 21s
-
Challenge: Strings, dates, and parsing52s
-
Solution: Strings, dates, and parsing2m 5s
-
-
-
-
-
-
-
-