Advertisement
anlyx

3_A_VBNET

Dec 7th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.79 KB | None | 0 0
  1. Public Class Form1
  2.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  3.         RichTextBox1.AllowDrop = True
  4.     End Sub
  5.  
  6.     Private Sub RichTextBox1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragOver
  7.  
  8.         If e.Data.GetDataPresent(System.Windows.Forms.DataFormats.StringFormat) Then
  9.             e.Effect = DragDropEffects.Copy
  10.         End If
  11.     End Sub
  12.  
  13.     Private Sub RichTextBox1_DragDrop(sender As Object, e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragDrop
  14.  
  15.         Dim files() As String = e.Data.GetData(DataFormats.FileDrop)
  16.         For Each path In files
  17.             RichTextBox1.Clear()
  18.             RichTextBox1.AppendText(path)
  19.         Next
  20.     End Sub
  21.  
  22. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement