- 日時: 2011/04/05 10:34
- 名前: 花ちゃん
- * カテゴリー:[テキストボックス]
----------------------------------------------------------------------------------- Re: TextBoxのCtrl+Aについて - 花ちゃん 2005/10/01-08:55 No.4549 ----------------------------------------------------------------------------------- オーソドックスにやるならこんな感じでしょうか?
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
|