拖曳文字到textbox ctrl a全選 (VB.NET)

拖曳文字到textbox ctrl a全選 (VB.NET)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtUrl.Text = "http://tw.yahoo.com/"  ' 預設網址
        txtUrl.AllowDrop = True
    End Sub

   Private Sub txtUrl_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtUrl.DragDrop
        If (e.Data.GetDataPresent(DataFormats.Text)) Then
            txtUrl.Text = e.Data.GetData(DataFormats.Text)
        Else
            ' Display the no-drop cursor. 
            e.Effect = DragDropEffects.None
        End If
    End Sub

    Private Sub txtUrl_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles txtUrl.DragEnter
        e.Effect = DragDropEffects.Copy
    End Sub

 


 

'ctrl+a 全選
    Private Sub txtUrl_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtUrl.KeyDown
        If e.Modifiers = Keys.Control And e.KeyCode = Keys.A Then txtUrl.SelectAll()
    End Sub


如有錯誤 歡迎指正