Please Help with RichTextBox 
Author Message
 Please Help with RichTextBox

in a small editor i've a MDI form with children forms bringing each an RTB
control.

1. is there a way to drag files from explorer on the RTB and have a new
form pop up opening the file? i'm doing it when dragging on the MDI, but if
i drag onto the RTB i always get an embedded object.

2. what am i to do to make the editor open a file like a param (s.t. like
"editor.exe file1.txt) and putting a link to the editor in the SendTo
folder?

thanks in advance, pal
--
Andrea Palazzi

cedoc no zelig



Fri, 20 Apr 2001 03:00:00 GMT  
 Please Help with RichTextBox
How about this as a starting point ...

Form1 is the mdichild with the RTF control. Set the RTF OLEDropMode to
manual, and add the following code to the form:

Private Sub RichTextBox1_OLEDragDrop(Data As RichTextLib.DataObject, Effect
As Long, Button As Integer, Shift As Integer, x As Single, Y As Single)

   If Data.GetFormat(vbCFFiles) = True Then

      If RichTextBox1.Text > "" Then

         Dim newform As New Form1
         newform.RichTextBox1.LoadFile Data.Files.Item(1)

      Else

         RichTextBox1.LoadFile Data.Files.Item(1)

      End If

   End If

End Sub

On the mdi parent, with its OLEDropMode also set to manual, add the
following:

Private Sub MDIForm_OLEDragDrop(Data As DataObject, Effect As Long, Button
As Integer, Shift As Integer, x As Single, Y As Single)

   If Data.GetFormat(vbCFFiles) = True Then

         Dim newform As New Form1
         newform.RichTextBox1.LoadFile Data.Files.Item(1)

   End If

End Sub

Dropping a file onto the parent background will open a new form with the
document.  Dropping the file onto a child form with an empty RTF will load
the text into that form's RTF.  Dropping onto an already-populated RTF
control will open a new RTF form with the file.

--

Randy Birch, MVP Visual Basic

http://www.mvps.org/vbnet/
http://www.mvps.org/ccrp/

Quote:

>in a small editor i've a MDI form with children forms bringing each an RTB
>control.

>1. is there a way to drag files from explorer on the RTB and have a new
>form pop up opening the file? i'm doing it when dragging on the MDI, but if
>i drag onto the RTB i always get an embedded object.

>2. what am i to do to make the editor open a file like a param (s.t. like
>"editor.exe file1.txt) and putting a link to the editor in the SendTo
>folder?

>thanks in advance, pal
>--
>Andrea Palazzi

>cedoc no zelig



Fri, 20 Apr 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Please help: coloring RichTextBox

2. PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP, PLEASE HELP,

3. Can anyone HELP me PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE PLEASE

4. RichTextBox LinkClicked event - PLEASE HELP ASAP!

5. RichTextBox help please

6. RichTextBox Problem - PLEASE HELP

7. Help Me please Bug on RichTextBox ??

8. RichTextBox.SelPrint Bug??? Please Help

9. Please help me with Print Preview in RichTextBox

10. PLEASE HELP PLEASE HELP PLEASE HELP

11. RichTextBox Control Setting Fonts - HELP HELP HELP !!!!

12. Repost - RichTextBox and single quotes - please ...

 

 
Powered by phpBB® Forum Software