Re: Can't SetText to Clipboard

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: Bob Butler (tiredofit_at_nospam.com)
Date: 05/17/04


Date: Mon, 17 May 2004 06:00:53 -0700


"WangYK" <WangYK@Telkom.NET> wrote in message
news:uW1F5Y9OEHA.2960@TK2MSFTNGP10.phx.gbl
> Why is it I can't get text to Clipboard when the Clipboard has already
> contained text?
>
> Situation simulation:
> Open IE,
> copy a text on HTML page, (i.e.:ABC)

That copies HTML-formatted text to the clipboard as well as plain text

> at VB, I code :
>
> Private Sub cmdCopy_Click()
> Clipboard.SetText cmdCopy.Caption, vbCFText '(i.e.:the caption is set
> to DEF)
> Clipboard.SetText cmdCopy.Caption, vbCFRTF
> End Sub

You overwrote the plain text and any RTF text (on't know offhand if IE put
any there or not)

> Then I go to "Start Menu|Run" of Windows, right click, Paste
> viola the caption "DEF" is pasted,

The run box is looking just for plain text so you get the last thing written

> but when I go to some a web page textbox and paste it there
> the pasted text is "ABC"

Right, the web browser looks for HTML text first and finds the info that IE
put there originally. Open Word and use Edit / Paste Special and you can
select the various formats available to see what each holds.

> Is this bug?

No, it's "by design"

> How to solve such situation?

Use "Clipboard.Clear" in your VB app to remove anything already there (in
which case the web browser will find no HTML text so will look for other
formats) or find a way to put HTML-formatted text on the clipboard.

-- 
Reply to the group so all can participate
VB.Net... just say "No"


Relevant Pages

  • Re: Export Data To Clipboard
    ... Dim strBuffer As String ... >to copy the records returned by a query to the clipboard. ... other formats) ... >put plain text on the clipboard without the formatted ...
    (microsoft.public.access.externaldata)
  • Re: accessing document object model (DOM) using vb and asp.net
    ... This is crude and prone to error-- Powerpoint ... where one button click creates the html and performs the ... copy to clipboard and the second button click creates a Powerpoint instance ... >> My development environment is Visual Web developer Express 2005. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Stripping all formatting from Word doc
    ... You get a choice of formats, depending on what ... > you copied to the clipboard and what you are pasting into. ... >>> Word does NOT paste 'plain text' unless you force it to. ...
    (microsoft.public.mac.office.word)
  • Re: how to save the data of a JTable to a html file?
    ... Because it is an Applet program, if I want to access local files, now I ... Perhaps not directly relevant (it's a piece of cake to generate HTML ... } catch (ClassNotFoundException exc) { ... java.awt.datatransfer.Clipboard clipboard = ...
    (comp.lang.java.programmer)
  • Re: Export Data To Clipboard
    ... to copy the records returned by a query to the clipboard. ... clipboard as both plain text and RTF text (and perhaps in other formats) ...
    (microsoft.public.access.externaldata)