My.Computer.Clipboard.SetAudio Method
Writes audio data to the Clipboard.
' Usage
My.Computer.Clipboard.SetAudio(audioBytes)
My.Computer.Clipboard.SetAudio(audioStream)
' Declaration
Public Sub SetAudio( _
ByVal audioBytes As Byte() _
)
' -or-
Public Sub SetAudio( _
ByVal audioStream As System.IO.Stream _
)
Parameters
- audioBytes
Byte array. Audio data to be written to the Clipboard. Required.
- audioStream
Stream Audio data to be written to the clipboard. Required.
Exceptions
No exceptions are thrown by this method.
Remarks
This method can be used to write the audio data as either a byte array or an audio stream.
Security Note |
---|
Because the Clipboard can be accessed by other users, do not use it to store sensitive information, such as passwords or confidential data. |
Tasks
The following table lists examples of tasks involving the My.Computer.Clipboard.SetAudio method.
To | See |
---|---|
Write audio data to the Clipboard |
How to: Save an Audio Stream to the Clipboard in Visual Basic |
Example
This example creates the byte array musicReader
, reads the file cool.wav
into it, and then writes it to the Clipboard.
Dim musicReader As Byte()
musicReader = My.Computer.FileSystem.ReadAllBytes("cool.wav")
My.Computer.Clipboard.SetAudio(musicReader)
Replace cool.wav
with the name and path of the file you wish to read.
Requirements
Namespace: Microsoft.VisualBasic.MyServices
Class: ClipboardProxy (provides access to Clipboard)
Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)
Availability by Project Type
Project type | Available |
---|---|
Windows Application |
Yes |
Class Library |
Yes |
Console Application |
Yes |
Windows Control Library |
Yes |
Web Control Library |
No |
Windows Service |
Yes |
Web Site |
No |
Permissions
No permissions are required.
See Also
Reference
My.Computer.Clipboard Object
My.Computer.Clipboard.ContainsAudio Method
My.Computer.Clipboard.GetAudioStream Method
System.IO.Stream
System.Windows.Forms.Clipboard.SetAudio