need to cast RichTextBox1.CanPaste(??) argument

  • Thread starter Thread starter SamSpade
  • Start date Start date
S

SamSpade

If you don't tell it the format i.e., RichTextBox1.Paste(), it seems to be
able to paste anything the rtb can handle.

However the RichTextBox1.CanPaste(??) requires a parameter to identifying
the format.

The underlying command
SendMessage(RichTextBox1.Handle, Win32.User.EM_CANPASTE, 0, 0)

with the 0 as shown instead of a format ID will check to see if there is
anything that can be pasted.



I suspect RichTextBox1.Paste(0) would do the same if I could cast the 0 to a
DataFormat.Format but I can't try it because I don't know how to do the
cast. Is it possible in VB?
 
Hi,

Dim myFormat As DataFormats.Format

myFormat = DataFormats.GetFormat(DataFormats.Rtf)

RichTextBox1.Paste(myFormat)



Ken
 
But if I do RichTextBox1.Paste() it will paste Bitmaps
even if there is no RTF on the clipboard.

And if I use the SendMessage it will respond with an OK for Bitmaps

Thanks
 
Back
Top