Hi All,
Could someone help me out please. I am trying to enable drag and drop operations into richtextbox control and I want to be able to drag and drop formated text (from word headings, bold fonts etc...) I've managed to drag and drop text but all the formating is getting lost
VB Code:
Me.RichTextBox1.AllowDrop = True Me.RichTextBox1.AutoWordSelection = True Private Sub RichTextBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragEnter If (e.Data.GetDataPresent(DataFormats.Text)) Then e.Effect = DragDropEffects.Copy Else e.Effect = DragDropEffects.None End If End Sub Private Sub RichTextBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles RichTextBox1.DragDrop Dim i As Int16 Dim s As String ' Get start position to drop the text. i = CType(RichTextBox1.SelectionStart, Int16) s = RichTextBox1.Text.Substring(i) RichTextBox1.Text = RichTextBox1.Text.Substring(0, i) ' Drop the text on to the RichTextBox. RichTextBox1.Text = RichTextBox1.Text + _ e.Data.GetData(DataFormats.Text).ToString() RichTextBox1.Text = RichTextBox1.Text + s End Sub
maybe i am missing some property?


Reply With Quote