String Manipulation:

There are many built-in functions that can be used with strings. (A string is a collection of characters). Here are some simple examples for cut & paste.

 

Convert to Upper Case:


Result will display here.

Code for the Button:

Sub btnConvertToUpper_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConvertToUpper.Click
       lblUpperCase.Text = TextBox1.Text.ToUpper
End Sub

Convert to Lower Case:


Result will display here.

Code for the Button:

Sub btnConvertToLower_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConvertToLower.Click
       lblLowerCase.Text = TextBox2.Text.ToLower
End Sub

Get Length of a String: (Display Letter Count)


     Result will display here.

Code for the Button:


Sub btnGetLength_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGetLength.Click 
      Dim length As Integer = TextBox3.Text.Length
      Dim CountLetters As Integer = length + 1
      lblGetLength.Text = "There are " + CountLetters.ToString + " letters in your word."
End Sub

VB.NET vs. C#

Variables

Decisions

Built In Functions