Tuesday, March 18, 2008

UpperCase and LowerCase with API in VB

Uppercase and lowercase are general functions in every programming language. Now, I want to show how to use uppercase and lowercase in API functions.

I do it with visual basic 6 and windows library ( user32.dll ).

Okay, we start with uppercase first.

Uppercase is a function to generate anything string into uppercase string.

Here the code:

Declare Function CharUpper Lib “user32.dll” Alias “CharUpperA”
(ByVal lpsz As String) As String

Private sub command1_click()

Text1.Text = CharUpper(“layong”)

End Sub


The result will be: “LAYONG”

Okay. We move on the lowercase function. Lowercase is a function to change a string into the lowercase string.

Here the code:

Declare Function CharLower Lib “user32.dll” Alias “CharLowerA”
(ByVal lpsz As String) As String

Private Sub Command1_Click()

Text1.Text = CharLower (“LAYONG”)

End Sub

The result will be “layong”.

Simple huh… :)

Enjoy it…




0 comments:

Google

Microsoft News for ADO .NET:

Our Email Address:

blog.programming@gmail.com