HOME       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

以前コンテンツ:【VB】ADO Recordset で RecordCount プロパティが -1 を返す場合
次のコンテンツ:【VB】命令ライン(command line)から引数を渡して受ける方法



Copyright(c) 2007-2024 dojeun.com All Rights Reserved.

Valid XHTML 1.0 Transitional