Newbie question: Rich Text Box vs. Text Box 
Author Message
 Newbie question: Rich Text Box vs. Text Box

In my VB project (a text editor), I have been confused about the issue
of whether to make my client writing area a "TextBox" or a
"RichTextBox". Through experimentation, I have seen how the Cut, Copy,
and Paste processes are handled automatically and seemlessly for
RichTextBoxes, and I was very encouraged by this.

Currently, the only obstacle I am encountering with respect to my
RichTextBox has to do with OLE Drag and Drop. Specifically, my code to
handle the dropping of a file onto my TextBox was...

Private Sub txtDoc_OLEDragDrop(Data As DataObject, Effect As Long,
Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Data.GetFormat(vbCFFiles) Then
                Dim vFN

                For Each vFN In Data.Files
                        DropFile txtDoc, vFN
                        Exit For
                Next vFN
        End If
End Sub

...and this worked OK when I was using a "TextBox" instead of a
"RichTextBox". Please note that the cludgy aborted For Each loop was
done because I only accept the first of multiple files dropped onto this
TextBox. Also, I have a routine called "DropFile" which does the
processing for a given file.

The problems I encountered when I tried to use this same code with a
RichTextBox are...

(1) the parameter...
        Data As DataObject needed to be changed to "Data As
I make this change, and that problem was solved.

(2) the expression "Data.Files" (in "For Each vFN In Data.Files") causes
the run-time error.
        Runtime error "438" - Object doesn't support this property or method.
Does anyone know what property I would use in place of "Files" for a
RichTextBox? The object browser tells me that I should be able to use
the "Files" property.


Jon Kinsting

P.S. The documentation says that if I declare both the Drag property and
Drop property (in my RichTextBox) to be automatic, then the drop
handling will be automatic, and I will not need to code anything.
However, when I do this and attempt to drop a file onto the RichTextBox,
only the file's icon appears in that RTB (not the files content/text).

Sat, 02 Jun 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Rich Text Box vs. Text Box Scrolling

2. Newbie Question - Moving from text box to text box (without tab)

3. Colour Text Box/Class Wrapper for Rich Text Box

4. help: formatting rich text box/text box

5. Rich Text Box or text box control

6. Looking for APIs for text box and Rich text box

7. Some [hopefully] easy questions - text and rich text boxes

8. Rich Text Box: Can I remove text and keep multicolored text

9. Default Button vs. Text Box - Newbie Question

10. dear text box guru(s): fancy text box question...

11. Text box text on new page text box

12. Rich Text Box vs WordPad


Powered by phpBB® Forum Software