Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / April 2005

Tip: Looking for answers? Try searching our database.

RichTextBox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sanjay - 04 Apr 2005 15:12 GMT
hi all,
In VB6 we used to have a property called OLEObjects on RichTextBox.
I used it to make my richTextbox not accept OLE objects when user tries to
paste.
Code something like following:

If RichTextBox1.OLEObjects.count > 0 Then

     If Len(Clipboard.getText) = 0 Then
          ' show Some  message regarding OLE object pasting not supported
     Else
        RichTextBox1.SelRTF = Clipboard.getText
     End If

     RichTextBox1.OLEObjects.remove (0)

 End If

I want to know how can it be achieved using .net RichTextBox.
plz help me on the same.
any help would be appreciated.

thanks

Sanjay Singh
Stoitcho Goutsev \(100\) [C# MVP] - 05 Apr 2005 00:48 GMT
Sanjay,

Even though you can create your own OLE objects handler (overriding
RichTextBox's CreateRichEditOleCallback) I don't think this is what you want
to do. This would be the best solution, but windows forms doesn't provide
IRichEditOleCallback interface out of the box. So what I'd suggest is to
handle DragEnter as well as ctrl+v key combination and check the DataObject
in the clipboard ot that is dragged by the user for text inside. This is
pretty easy to do (see System.Windows.Forms.DataObject class in MSDN for
more info). So you can allow drop or paste at your discretion.

Signature

Stoitcho Goutsev (100) [C# MVP]

> hi all,
> In VB6 we used to have a property called OLEObjects on RichTextBox.
[quoted text clipped - 21 lines]
>
> Sanjay Singh
Sanjay - 05 Apr 2005 06:04 GMT
hi Stoitcho,

but I dont find any event like "DragEnter" . Do you mean "Enter" event or
what.
please clarify it.

thanks

sanjay

> Sanjay,
>
[quoted text clipped - 32 lines]
> >
> > Sanjay Singh

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.