Convert input value into another value type in VB.NET

This article shows you the process of conversion of user value into value type.
  • 2030

As you know, data types in the .NET framework come in so many varieties, all the data types holds the own specific fix type of values and at the run time returns the same type for the result. But many times user need to change the data type or you can say convert a specific value into another type of value at the run time.

To help clear things up, I describes what actually you have to do in that situation of converting values. Once you understand that, you'll begin to see what the best approaches are for various situations.

Examples

  
Module Module1
    Sub Main()
        Dim Input As Integer
        Console.WriteLine("Enter the marks...")
        Input = Val(Console.ReadLine())
        If Input >= 75 Then
            Console.WriteLine("Very Good!")
        ElseIf Input <= 55 Then
            Console.WriteLine("Very Poor!")
        End If
            Console.ReadLine()
    End Sub
 End
Module

OUTPUT

9.gif
 

CONCLUSION

This article helps you to understand that how you can convert your input value into another type at the run time in VB.NET

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.