Translate

Sunday 2 June 2013

String Data type in VB.NET



String Data type

In this blog we will the another datatype called 'String' this datatype stores texts .

Dim str as String =" Hello"

The variable str contains 'Hello' like this we can store any text in String datatype.

Let us see an example.

Module Example4
    Sub main()
        Dim Greet As String = "Hello, "
        Dim Msg As String
      
       Console.Write("Enter Your Name: ")
        Msg = Console.ReadLine()

        Console.WriteLine()
        Console.WriteLine(Greet & Msg)
        Console.ReadKey()
    End Sub
End Module




The above example have two variable Greet and Msg, Greet is assigned with the text " Hello" and Msg will get value during runtime output will display Hello with value containing in Msg variable.

In the next blog we will see Control Structure we mentioned in first blog.

No comments:

Post a Comment