This is a visual basic 6.0 source code that inverts the case of the selected text. If the upper case text is selected then it will convert it into lower case text. Otherwise to upper case.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | '******************************************************* '* MYCPLUS Sample Code - https://www.mycplus.com * '* * '* This code is made available as a service to our * '* visitors and is provided strictly for the * '* purpose of illustration. * '* * '* Please direct all inquiries to saqib at mycplus.com * '******************************************************* Public Function InvertCase(ByVal Text As String) As Text Dim i As Integer Dim sBuff As String, sFinished As String 'For every selected letter For i = 1 To Len(Text) sBuff = Mid$(Text, i, 1) '// Get letter Select Case Asc(sBuff) Case 65 To 90 '// If it is upper case sBuff = LCase(sBuff) '// make it lower Case 97 To 122 '// if it is lower case sBuff = UCase(sBuff) '// make it upper End Select sFinished = sFinished & sBuff '// Put that all in the buffer Next i InvertCase = sFinished End Function |