SetText Method


SetText Method

Location

My.Computer.Clipboard.SetText

Syntax

 My.Computer.Clipboard.SetText(text[, format]) 


text (required; String)

The text to be written to the system clipboard.


format (optional; TextDataFormat enumeration)

The specific format of the text to write to the system clipboard. One of the following System.Windows.Forms.TextDataFormat enumeration values.

Value

Description

Not supplied

Any type of text

CommaSeparatedValue

Comma-separated fields of data in one or more records

Html

HTML format

Rtf

Rich Text Format

UnicodeText

16-bit Unicode character text


If this parameter is not specified, UnicodeText is used by default.

Description

The SetText method writes a string of text to the system clipboard in a specified text format. If no specific format is indicated, text is written as plain Unicode text.

Usage at a Glance

  • This method is only valid in non-server applications.

  • Security restrictions in place for the active user may limit access to the system clipboard.

  • An exception is thrown if invalid or missing string data is passed to the method.

Example

The following code adds basic text to the clipboard.

 My.Computer.Clipboard.SetText("This text is simple.") 

Related Framework Entries

  • Microsoft.VisualBasic.MyServices.ClipboardProxy.SetText Method

  • System.Windows.Forms.Clipboard.SetText Method

See Also

Clipboard Object, ContainsText Method, GetText Method, SetAudio Method, SetData Method, SetDataObject Method, SetFileDropList Method, SetImage Method, SetText Method




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net