Programming Strings
 

We learnt about the word "integer", and that integer variables held numbers.
Names are not numbers, that's where Strings come in.

Actually a string used to set up a variable to hold text.

Dim FirstName As String
Dim LastName As String

FirstName = "Niranjan"
LastName = "Meegammana"

don't forget the quotation marks! when storing text in a variable,


Double click your new button, and add the following code:

Dim FirstName As String
Dim LastName As String
Dim FullName As String

FirstName = "Niranjan"
LastName = "Meegammana"

FullName = FirstName & LastName

Textbox1.Text = FullName



FullName = FirstName & LastName

the ampersand symbol ( & ) is used to join strings together.
It's called Concatenation.


Exercise
Remove one of the ampersand symbols (&) from this line in your code:

FullName = FirstName & " " & LastName

 

 

Textbox text in your Variables



  • Add a new textbox to your form


  • With the textbox selected, locate the Name property in the Properties area


  •  

    The current value of the Name property is Textbox2.

     

    Textbox2.Text = FullName


     


    (c) Shilpa Sayura Foundation 2006-2017