Uppercase and Lowercase characters are capital and lowercase letters (big and small. upper:ABCDEFGHIJKLMNOPQRSTUVWXYZ lower: abcdefghijklmnopqrstuvwxyz.
In this article, we will going to create a program that can change casing of the letters either uppercase or lowercase when the text is highlighted.
Now, let's start this tutorial!
1. Let's start this tutorial by following the following steps in Microsoft Visual Basic 6.0: Open
Microsoft Visual Basic 6.0, click
Choose Standard EXE, and click
Open.
2. Next, add two buttons named
Button1 labeled as "
Uppercase",
Button2 labeled as "
Lowercase", and
Button3 labeled "
Clear". Insert also a Textbox named
Text1 for inputting your desired words. You must design your interface like this:
3. Now put this code for your code module.
Private Sub Command1_Click()
Dim textnotselected As Boolean
If textnotselected = True Then Exit Sub
Text1.SelText = StrConv(Text1.SelText, vbUpperCase)
End Sub
Private Sub Command2_Click()
Dim textnotselected As Boolean
If textnotselected = True Then Exit Sub
Text1.SelText = StrConv(Text1.SelText, vbLowerCase)
End Sub
Private Sub Command3_Click()
Text1.Text = ""
End Sub
We have initialized
variable textnotselected as Boolean. This variable is used that if we click any buttons such as uppercase and lowercase button it will not do any events as this variable is set to True.
SelText Property returns the text that the user selected in a text-entry area of a control, or returns an empty string ("") if no characters are selected. It also specifies the string containing the selected text of our text1. It is not available at design time; read/write at run time.
StrConv Method returns a string converted as specified, the first parameter is the string (Text1.SelText) and the second parameter is the conversion that has enumeration value specifying the type of conversion to perform such as vbLowerCase and vbUpperCase.
vbUpperCase converts the string to uppercase characters.
vbUpperCase converts the string to lowercase characters.
Output:
Download the source code and try it! :)
For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.
Best Regards,
Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:
[email protected]
Add and Follow me on Facebook:
https://www.facebook.com/donzzsky
Visit and like my page on Facebook at:
https://www.facebook.com/BermzISware