Controls [vb.net] TextBox Ctrl+c and Ctrl+v how to implement
페이지 정보
본문
Private Function SET_TEXT_BOX_CLIPBOARD_SHORTCUTS(ByRef f As Form) As Boolean
Dim C As Control = f
Do
C = f.GetNextControl(C, True)
Try
Select Case True
Case C Is Nothing
Case TypeOf C Is TextBox
AddHandler CType(C, TextBox).KeyUp, AddressOf TextBox_KeyUp
End Select
Catch ex As Exception
el.WriteToErrorLog(ex.Message, ex.StackTrace, "Error")
End Try
Loop Until C Is Nothing
End Function
Private Sub TextBox_KeyUp(sender As Object, e As KeyEventArgs)
Dim t As TextBox = CType(sender, TextBox)
If e.KeyData = (Keys.C Or Keys.Control) Then
t.Copy()
e.Handled = True
ElseIf e.KeyData = (Keys.X Or Keys.Control) Then
t.Cut()
e.Handled = True
ElseIf e.KeyData = (Keys.V Or Keys.Control) Then
t.Paste()
e.Handled = True
ElseIf e.KeyData = (Keys.A Or Keys.Control) Then
t.SelectAll()
e.Handled = True
ElseIf e.KeyData = (Keys.Z Or Keys.Control) Then
t.Undo()
e.Handled = True
End If
End Sub
- 이전글[vb.net] ToolTip 21.03.22
- 다음글[VB.NET] Sort Examples: Arrays and Lists - Dot Net Perls 21.03.18
댓글목록
등록된 댓글이 없습니다.