From the course: Visual Basic Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understand numeric to numeric conversions

Understand numeric to numeric conversions - Visual Basic Tutorial

From the course: Visual Basic Essential Training

Start my 1-month free trial

Understand numeric to numeric conversions

- [Instructor] The process of changing a value from one data type to another type is called a conversion. In this video, we'll look at conversion concepts for the VB built-in numeric types. To review, a variable is typed at declaration time. Once the type is set, it cannot be changed, and the variable can only hold a value of its defined type. For this discussion, we'll focus on the simpler numeric types and ignore class inheritance topics. In this example, we have the counter variable. It can only hold integer values. On line 51, assigning a integer literal is acceptable. On line 52, we attempt to assign a double floating point literal. Since the variable cannot contain a double, there must be a conversion to an integer. The red squiggle is there because I've configured Visual Basic to warn me about implicit conversions. Most details about this soon. On line 53, we used the Convert class to explicitly convert from a…

Contents