投稿日 | : 2005/10/01(Sat) 08:55 |
投稿者 | : 花ちゃん |
Eメール | : |
URL | : |
タイトル | : Re: TextBoxのCtrl+Aについて |
オーソドックスにやるならこんな感じでしょうか?
Option Explicit
Private KeySelectAll As Boolean
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
KeySelectAll = False
If KeyCode = vbKeyA And Shift = vbCtrlMask Then
If TypeOf Me.ActiveControl Is TextBox Then
Me.ActiveControl.SelStart = 0
Me.ActiveControl.SelLength = Len(Me.ActiveControl.Text)
KeySelectAll = True
End If
End If
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
If KeySelectAll Then
KeyAscii = 0
End If
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub