Rabu, 22 Juli 2009

Auto SmartCase

Procedure to change the small letters into capital letters automatically in accordance with the rules of writing, for example, small letters at the beginning of the word, small letters after the space / point.

Rem// AUTHOR

Nandy Novrizal (Original Source Code)

Rem// INTRODUCTION

Procedure to change the small letters into capital letters automatically in accordance with the rules of writing,

such small letters at the beginning of the word, small letters after the space / point.

Rem// PUBLIC PROCEDURE

Sub goSmartCase(TextBoxName As Control, KeyAscii As Integer)
On Error Resume Next
If Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = " " Or _
Mid(TextBoxName.Text, TextBoxName.SelStart,1) = "." _
Or Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = "" Or _
Mid(TextBoxName.Text,TextBoxName.SelStart, 1) = "(" _
Or Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = "{" Or _
Mid(TextBoxName.Text,TextBoxName.SelStart, 1) = "[" _
Or Mid(TextBoxName.Text, TextBoxName.SelStart, 1) = "/" Then
KeyAscii = Asc(UCase(Chr(KeyAscii)))
Else
KeyAscii = Asc(LCase(Chr(KeyAscii)))
End If
End Sub

Rem// HOW TO USE
Private Sub Text1_KeyPress(KeyAscii As Integer)
goSmartCase Text1, KeyAscii
End Sub



Tidak ada komentar:

Posting Komentar