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

Re: RichTextBox by Stoitcho

Stoitcho
Mon Apr 04 18:48:37 CDT 2005

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.


--
Stoitcho Goutsev (100) [C# MVP]

"Sanjay" <sanjays.singh@gmail.com> wrote in message
news:e5YfqBSOFHA.2144@TK2MSFTNGP09.phx.gbl...
> 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
>
>



Re: RichTextBox by Sanjay

Sanjay
Tue Apr 05 00:04:48 CDT 2005

hi Stoitcho,

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

thanks

sanjay

"Stoitcho Goutsev (100) [C# MVP]" <100@100.com> wrote in message
news:OCB4SDXOFHA.2384@tk2msftngp13.phx.gbl...
> 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.
>
>
> --
> Stoitcho Goutsev (100) [C# MVP]
>
> "Sanjay" <sanjays.singh@gmail.com> wrote in message
> news:e5YfqBSOFHA.2144@TK2MSFTNGP09.phx.gbl...
> > 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
> >
> >
>
>