VB.Net Program to Demonstrate the CStr() Function

You are currently viewing VB.Net Program to Demonstrate the CStr() Function

VB.Net program to demonstrate the CStr() function

'VB.Net program to demonstrate the CStr() function.

Module Module1

    Sub Main()
        Dim str As String = ""

        Dim n1 As Single = 10.25
        Dim n2 As Integer = 12
        Dim n3 As Double = 25.35
        Dim n4 As String = "122"

        str = CStr(n1)
        Console.WriteLine("String value: {0}", str)

        str = CStr(n2)
        Console.WriteLine("String value: {0}", str)

        str = CStr(n3)
        Console.WriteLine("String value: {0}", str)

        str = CStr(n4)
        Console.WriteLine("String value: {0}", str)
    End Sub
    
End Module

Output

String value: 10.25
String value: 12
String value: 25.35
String value: 122
Press any key to continue . . .

Ranjith Kumar

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coding Diksha. Here, I post about programming to help developers.

Leave a Reply