Converting UCase to LCase by clicking a button

alpertunga65

Registered User.
Local time
Today, 08:03
Joined
Mar 15, 2013
Messages
21
Hello,

I have a function for a keyboard. But only as UCase. I want to use that keyboard as LCase too. So I put a button to change it to LCase. Unfortunately I couldn't do it. Here is my function for UCase. How can I change my keyboard to LCase by clicking a Button then to UCase by clicking again? I need help...:banghead: And Thanks a lot...


Private Function harf(strKey As String) As String
Screen.PreviousControl.SetFocus
Me.Controls(Screen.ActiveControl.Name).SelStart = Nz(Len(Me.Controls(Screen.ActiveControl.Name)), 0)
Me.Controls(Screen.ActiveControl.Name).SelLength = 0
Me.Controls(Screen.ActiveControl.Name).Value = Me.Controls(Screen.ActiveControl.Name).Value & strKey
End Function

Private Sub Key_A_Click()
harf "A"
End Sub
Private Sub Key_B_Click()
harf "B"
End Sub
Private Sub Key_C_Click()
harf "C"
End Sub

Private Sub Key_D_Click()
harf "D"
End Sub

Private Sub Key_E_Click()
harf "E"
End Sub

Private Sub Key_F_Click()
harf "F"
End Sub

Private Sub Key_0_Click()
harf "0"
End Sub
Private Sub Key_1_Click()
harf "1"
End Sub
Private Sub Key_2_Click()
harf "2"
End Sub
Private Sub Key_3_Click()
harf "3"
End Sub
Private Sub Key_4_Click()
harf "4"
End Sub
Private Sub Key_5_Click()
harf "5"
End Sub
Private Sub Key_6_Click()
harf "6"
End Sub
Private Sub Key_7_Click()
harf "7"
End Sub
Private Sub Key_8_Click()
harf "8"
End Sub
Private Sub Key_9_Click()
harf "9"
End Sub
 
Create a global variable called SCase as boolean

1. On the form load event set Scase to False (lowercase)

2. On the 'shift' button on click event use the following code

SCase=Not SCase

3. In your harf function change the last line to
Code:
Me.Controls(Screen.ActiveControl.Name).Value = Me.Controls(Screen.ActiveControl.Name).Value & [COLOR=red]iif(Scase=true,UCase(strKey),LCase(strKey))
[/COLOR]
 

Users who are viewing this thread

Back
Top Bottom