Programming | | The UCase and LCase Functions:

The UCase and LCase Functions - Example Problem 8C:

When programming with string comparisons the .NET environment is case-sensitive. This means the string “A” is not the same as the string “a”. If you had an IF statement that was making a test with your string input for example: If EmployeesCODE = “A” Then, and during run time the user entered a lower case “a” for the EmployeesCODE, the test would not be true and would follow the false path. This is where the UCase and LCase function is used to help the overall control structure of strings. The UCase and LCase function actually changes the string to uppercase or lowercase letters respectively.

The example below is of Example 8 and will continue to build this Example 8 on the UCase and LCase Functions to show the UCase(uppercase) function used with the IFTHENELSE statement. The UCase(uppercase) function is used to change the variable EmployeesCODE to an upper case letter. This method will help the program work correctly and effectively.

 

 

You would apply the same steps if you wanted to use the LCase function. As you can see below the LCase(lowercase) function is used to change the variable EmployeesCODE to a lower case letter.

 

Understand that since we are writing this programming in Window Application you are going to need to wrap the txtEmpoyeeCode.text control properties inside the UCase(......) or LCase(......) Function. For example: UCase(txtEmpoyeeCode.text) or LCase(txtEmpoyeeCode.text).


Directions for turning in Example problem - In the classroom: In this example problem you will have a print code and the screen shot (snipping Tool) for Example Problem 8. Once you get this output try to use the Snipping program to copy the screen shots and put it in a Word Document.

Directions for turning in Example problem - Virtual: Virtual No Printing just upload the assignment files to Canvas Module 4 Example Problem 8. You will NOT need to print out any documents just submit this example problem in the Canvas drop box. Note you should have two screen shots: Example 8 Code, and the Form (Run Time screen). Put all screen shots (images) in a Word Document and send me the file. Save the Word document as the example problem: Example 8 and your first and last name.

Please note, that you will need to re-save this file as a pdf file before uploading. Here is an example video on how to do that: See Video > > >     How to save a Word file to a pdf   right click mouse and select... (Open link in new tab)