DOJEUN's Notepad
 LISTへ 

【VB】入力時に小文字を大文字に変換する

入力時に小文字を大文字に変換する


説明

 FormにTextBoxを置く(オブジェクト名:Text1)
 Text1プロパティの IMEModeに「3 - オフ固定」を指定する。
 Text1のKeyPress eventに以下のように定義する。

Sub定義

  Private Sub Text1_KeyPress(KeyAscii As Integer)
     If Chr(KeyAscii) >= "a" And Chr(KeyAscii) <= "z" Then
      KeyAscii = Asc(StrConv(Chr(KeyAscii), vbUpperCase))
     End If
   End Sub