-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
Copy pathClipboard.xml
1730 lines (1522 loc) · 127 KB
/
Clipboard.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<Type Name="Clipboard" FullName="System.Windows.Forms.Clipboard">
<TypeSignature Language="C#" Value="public sealed class Clipboard" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi sealed beforefieldinit Clipboard extends System.Object" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.Clipboard" />
<TypeSignature Language="VB.NET" Value="Public NotInheritable Class Clipboard" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1" />
<TypeSignature Language="F#" Value="type Clipboard = class" />
<TypeSignature Language="C++ CLI" Value="public ref class Clipboard sealed" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1" />
<TypeSignature Language="C#" Value="public static class Clipboard" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi abstract sealed beforefieldinit Clipboard extends System.Object" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<TypeSignature Language="VB.NET" Value="Public Class Clipboard" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<TypeSignature Language="C++ CLI" Value="public ref class Clipboard abstract sealed" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-8.0;windowsdesktop-9.0">
<AttributeName Language="C#">[System.Runtime.CompilerServices.Nullable(0)]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.CompilerServices.Nullable(0)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Provides methods to place data on and retrieve data from the system Clipboard. This class cannot be inherited.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
For a list of predefined formats to use with the <xref:System.Windows.Forms.Clipboard> class, see the <xref:System.Windows.Forms.DataFormats> class.
Call <xref:System.Windows.Forms.Clipboard.SetDataObject%2A> to put data on the Clipboard, replacing its current contents. To place a persistent copy of the data on the Clipboard, set the `copy` parameter to `true`.
> [!NOTE]
> To place data on the Clipboard in multiple formats, use the <xref:System.Windows.Forms.DataObject> class or an <xref:System.Windows.Forms.IDataObject> implementation. Place data on the Clipboard in multiple formats to maximize the possibility that a target application, whose format requirements you might not know, can successfully retrieve the data.
Call <xref:System.Windows.Forms.Clipboard.GetDataObject%2A> to retrieve data from the Clipboard. The data is returned as an object that implements the <xref:System.Windows.Forms.IDataObject> interface. Use the methods specified by <xref:System.Windows.Forms.IDataObject> and fields in <xref:System.Windows.Forms.DataFormats> to extract the data from the object. If you do not know the format of the data you retrieved, call the <xref:System.Windows.Forms.IDataObject.GetFormats%2A> method of the <xref:System.Windows.Forms.IDataObject> interface to get a list of all formats that data is stored in. Then call the <xref:System.Windows.Forms.IDataObject.GetData%2A> method of the <xref:System.Windows.Forms.IDataObject> interface, and specify a format that your application can use.
In .NET Framework 2.0, the <xref:System.Windows.Forms.Clipboard> class provides additional methods that make it easier to work with the system Clipboard. Call the <xref:System.Windows.Forms.Clipboard.Clear%2A> method to remove all data from the Clipboard. To add data of a particular format to the Clipboard, replacing the existing data, call the appropriate `Set`*Format* method, such as <xref:System.Windows.Forms.Clipboard.SetText%2A>, or call the <xref:System.Windows.Forms.Clipboard.SetData%2A> method to specify the format. To retrieve data of a particular format from the Clipboard, first call the appropriate `Contains`*Format* method (such as <xref:System.Windows.Forms.Clipboard.ContainsText%2A>) method to determine whether the Clipboard contains data in that format, and then call the appropriate `Get`*Format* method (such as <xref:System.Windows.Forms.Clipboard.GetText%2A>) to retrieve the data if the Clipboard contains it. To specify the format in these operations, call the <xref:System.Windows.Forms.Clipboard.ContainsData%2A> and <xref:System.Windows.Forms.Clipboard.GetData%2A> methods instead.
> [!NOTE]
> All Windows-based applications share the system Clipboard, so the contents are subject to change when you switch to another application.
>
> An object must be serializable for it to be put on the Clipboard. If you pass a non-serializable object to a Clipboard method, the method will fail without throwing an exception. See <xref:System.Runtime.Serialization> for more information on serialization. If your target application requires a very specific data format, the headers added to the data in the serialization process may prevent the application from recognizing your data. To preserve your data format, add your data as a <xref:System.Byte> array to a <xref:System.IO.MemoryStream> and pass the <xref:System.IO.MemoryStream> to the <xref:System.Windows.Forms.DataObject.SetData%2A> method.
>
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
>
> Special considerations may be necessary when using the metafile format with the Clipboard. Due to a limitation in the current implementation of the <xref:System.Windows.Forms.DataObject> class, the metafile format used by the .NET Framework may not be recognized by applications that use an older metafile format. In this case, you must interoperate with the Win32 Clipboard application programming interfaces (APIs).
## Examples
The following code example uses <xref:System.Windows.Forms.Clipboard> methods to place data on and retrieve it from the system Clipboard. This code assumes `button1`, `button2`, `textBox1`, and `textBox2` have been created and placed on the form.
The `button1_Click` method calls <xref:System.Windows.Forms.Clipboard.SetDataObject%2A> to take selected text from the text box and place it on the system Clipboard.
The `button2_Click` method calls <xref:System.Windows.Forms.Clipboard.GetDataObject%2A> to retrieve data from the system Clipboard. The code uses <xref:System.Windows.Forms.IDataObject> and <xref:System.Windows.Forms.DataFormats> to extract the data returned and displays the data in `textBox2`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic Clipboard Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.DataObject" />
<altmember cref="T:System.Windows.Forms.DataFormats" />
<altmember cref="T:System.Windows.Forms.IDataObject" />
<related type="Article" href="/dotnet/framework/winforms/additional-security-considerations-in-windows-forms">Additional Security Considerations in Windows Forms</related>
</Docs>
<Members>
<Member MemberName="Clear">
<MemberSignature Language="C#" Value="public static void Clear ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void Clear() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.Clear" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub Clear ()" />
<MemberSignature Language="F#" Value="static member Clear : unit -> unit" Usage="System.Windows.Forms.Clipboard.Clear " />
<MemberSignature Language="C++ CLI" Value="public:
 static void Clear();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Removes all data from the Clipboard.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Because the Clipboard is shared by multiple processes, calling this method may have an impact on those processes.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
</Docs>
</Member>
<Member MemberName="ContainsAudio">
<MemberSignature Language="C#" Value="public static bool ContainsAudio ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsAudio() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.ContainsAudio" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ContainsAudio () As Boolean" />
<MemberSignature Language="F#" Value="static member ContainsAudio : unit -> bool" Usage="System.Windows.Forms.Clipboard.ContainsAudio " />
<MemberSignature Language="C++ CLI" Value="public:
 static bool ContainsAudio();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Indicates whether there is data on the Clipboard in the <see cref="F:System.Windows.Forms.DataFormats.WaveAudio" /> format.</summary>
<returns>
<see langword="true" /> if there is audio data on the Clipboard; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method to determine whether the Clipboard contains audio data before retrieving it with the <xref:System.Windows.Forms.Clipboard.GetAudioStream%2A> method.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following code example demonstrates the use of this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet20":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet20":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="F:System.Windows.Forms.DataFormats.WaveAudio" />
<altmember cref="M:System.Windows.Forms.Clipboard.GetAudioStream" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetAudio" />
</Docs>
</Member>
<Member MemberName="ContainsData">
<MemberSignature Language="C#" Value="public static bool ContainsData (string format);" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsData(string format) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.ContainsData(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ContainsData (format As String) As Boolean" />
<MemberSignature Language="F#" Value="static member ContainsData : string -> bool" Usage="System.Windows.Forms.Clipboard.ContainsData format" />
<MemberSignature Language="C++ CLI" Value="public:
 static bool ContainsData(System::String ^ format);" />
<MemberSignature Language="C#" Value="public static bool ContainsData (string? format);" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="System.String" Index="0" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0;windowsdesktop-10.0" />
</Parameters>
<Docs>
<param name="format">The format of the data to look for. See <see cref="T:System.Windows.Forms.DataFormats" /> for predefined formats.</param>
<summary>Indicates whether there is data on the Clipboard that is in the specified format or can be converted to that format.</summary>
<returns>
<see langword="true" /> if there is data on the Clipboard that is in the specified <paramref name="format" /> or can be converted to that format; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.DataFormats> class contains pre-defined format names that you can use with this method.
Use this method to determine whether the Clipboard contains data in the specified format or a compatible format before retrieving it with the <xref:System.Windows.Forms.Clipboard.GetData%2A> method.
> [!NOTE]
> Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
>
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet10":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.Windows.Forms.DataFormats" />
<altmember cref="M:System.Windows.Forms.Clipboard.GetData(System.String)" />
<altmember cref="M:System.Windows.Forms.Clipboard.SetData(System.String,System.Object)" />
</Docs>
</Member>
<Member MemberName="ContainsFileDropList">
<MemberSignature Language="C#" Value="public static bool ContainsFileDropList ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsFileDropList() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.ContainsFileDropList" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ContainsFileDropList () As Boolean" />
<MemberSignature Language="F#" Value="static member ContainsFileDropList : unit -> bool" Usage="System.Windows.Forms.Clipboard.ContainsFileDropList " />
<MemberSignature Language="C++ CLI" Value="public:
 static bool ContainsFileDropList();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Indicates whether there is data on the Clipboard that is in the <see cref="F:System.Windows.Forms.DataFormats.FileDrop" /> format or can be converted to that format.</summary>
<returns>
<see langword="true" /> if there is a file drop list on the Clipboard; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A file drop list is a collection of strings containing path information for files.
Use this method to determine whether the Clipboard contains a file drop list before retrieving it with the <xref:System.Windows.Forms.Clipboard.GetFileDropList%2A> method.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet30":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet30":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="F:System.Windows.Forms.DataFormats.FileDrop" />
<altmember cref="M:System.Windows.Forms.Clipboard.GetFileDropList" />
<altmember cref="M:System.Windows.Forms.Clipboard.SetFileDropList(System.Collections.Specialized.StringCollection)" />
</Docs>
</Member>
<Member MemberName="ContainsImage">
<MemberSignature Language="C#" Value="public static bool ContainsImage ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsImage() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.ContainsImage" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ContainsImage () As Boolean" />
<MemberSignature Language="F#" Value="static member ContainsImage : unit -> bool" Usage="System.Windows.Forms.Clipboard.ContainsImage " />
<MemberSignature Language="C++ CLI" Value="public:
 static bool ContainsImage();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Indicates whether there is data on the Clipboard that is in the <see cref="F:System.Windows.Forms.DataFormats.Bitmap" /> format or can be converted to that format.</summary>
<returns>
<see langword="true" /> if there is image data on the Clipboard; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method to determine whether the Clipboard contains image data before retrieving it with the <xref:System.Windows.Forms.Clipboard.GetImage%2A> method.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet40":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet40":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="F:System.Windows.Forms.DataFormats.Bitmap" />
<altmember cref="M:System.Windows.Forms.Clipboard.GetImage" />
<altmember cref="M:System.Windows.Forms.Clipboard.SetImage(System.Drawing.Image)" />
</Docs>
</Member>
<MemberGroup MemberName="ContainsText">
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Indicates whether there is text data on the Clipboard.</summary>
<altmember cref="T:System.Windows.Forms.TextDataFormat" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.GetText" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetText" />
</Docs>
</MemberGroup>
<Member MemberName="ContainsText">
<MemberSignature Language="C#" Value="public static bool ContainsText ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsText() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.ContainsText" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ContainsText () As Boolean" />
<MemberSignature Language="F#" Value="static member ContainsText : unit -> bool" Usage="System.Windows.Forms.Clipboard.ContainsText " />
<MemberSignature Language="C++ CLI" Value="public:
 static bool ContainsText();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Indicates whether there is data on the Clipboard in the <see cref="F:System.Windows.Forms.TextDataFormat.Text" /> or <see cref="F:System.Windows.Forms.TextDataFormat.UnicodeText" /> format, depending on the operating system.</summary>
<returns>
<see langword="true" /> if there is text data on the Clipboard; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method checks for the presence of data in the <xref:System.Windows.Forms.TextDataFormat.UnicodeText> format on Windows XP Home Edition, Windows XP Professional, Windows Server 2003 and Windows 2000. Otherwise, this method checks for the presence of data in the <xref:System.Windows.Forms.TextDataFormat.Text> format.
Use this method to determine whether the Clipboard contains text data before retrieving it with the <xref:System.Windows.Forms.Clipboard.GetText%2A> method.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates an overload of the <xref:System.Windows.Forms.Clipboard.ContainsText%2A> method that is similar to this overload.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet50":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet50":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.Windows.Forms.TextDataFormat" />
<altmember cref="F:System.Windows.Forms.TextDataFormat.Text" />
<altmember cref="F:System.Windows.Forms.TextDataFormat.UnicodeText" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.GetText" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetText" />
</Docs>
</Member>
<Member MemberName="ContainsText">
<MemberSignature Language="C#" Value="public static bool ContainsText (System.Windows.Forms.TextDataFormat format);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig bool ContainsText(valuetype System.Windows.Forms.TextDataFormat format) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.ContainsText(System.Windows.Forms.TextDataFormat)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function ContainsText (format As TextDataFormat) As Boolean" />
<MemberSignature Language="F#" Value="static member ContainsText : System.Windows.Forms.TextDataFormat -> bool" Usage="System.Windows.Forms.Clipboard.ContainsText format" />
<MemberSignature Language="C++ CLI" Value="public:
 static bool ContainsText(System::Windows::Forms::TextDataFormat format);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="System.Windows.Forms.TextDataFormat" Index="0" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0;windowsdesktop-10.0" />
</Parameters>
<Docs>
<param name="format">One of the <see cref="T:System.Windows.Forms.TextDataFormat" /> values.</param>
<summary>Indicates whether there is text data on the Clipboard in the format indicated by the specified <see cref="T:System.Windows.Forms.TextDataFormat" /> value.</summary>
<returns>
<see langword="true" /> if there is text data on the Clipboard in the value specified for <paramref name="format" />; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use this method to determine whether the Clipboard contains text data before retrieving it with the <xref:System.Windows.Forms.Clipboard.GetText%2A> method.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet50":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet50":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<exception cref="T:System.ComponentModel.InvalidEnumArgumentException">
<paramref name="format" /> is not a valid <see cref="T:System.Windows.Forms.TextDataFormat" /> value.</exception>
<altmember cref="T:System.Windows.Forms.TextDataFormat" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.GetText" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetText" />
</Docs>
</Member>
<Member MemberName="GetAudioStream">
<MemberSignature Language="C#" Value="public static System.IO.Stream GetAudioStream ();" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.IO.Stream GetAudioStream() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.GetAudioStream" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetAudioStream () As Stream" />
<MemberSignature Language="F#" Value="static member GetAudioStream : unit -> System.IO.Stream" Usage="System.Windows.Forms.Clipboard.GetAudioStream " />
<MemberSignature Language="C++ CLI" Value="public:
 static System::IO::Stream ^ GetAudioStream();" />
<MemberSignature Language="C#" Value="public static System.IO.Stream? GetAudioStream ();" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.IO.Stream</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Retrieves an audio stream from the Clipboard.</summary>
<returns>A <see cref="T:System.IO.Stream" /> containing audio data or <see langword="null" /> if the Clipboard does not contain any data in the <see cref="F:System.Windows.Forms.DataFormats.WaveAudio" /> format.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Windows.Forms.Clipboard.ContainsAudio%2A> method to determine whether the Clipboard contains audio data before retrieving it with this method.
Use the <xref:System.Windows.Forms.Clipboard.SetAudio%2A> method to add audio data to the Clipboard.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet20":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet20":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.IO.Stream" />
<altmember cref="F:System.Windows.Forms.DataFormats.WaveAudio" />
<altmember cref="M:System.Windows.Forms.Clipboard.ContainsAudio" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetAudio" />
</Docs>
</Member>
<Member MemberName="GetData">
<MemberSignature Language="C#" Value="public static object GetData (string format);" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig object GetData(string format) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.GetData(System.String)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetData (format As String) As Object" />
<MemberSignature Language="F#" Value="static member GetData : string -> obj" Usage="System.Windows.Forms.Clipboard.GetData format" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Object ^ GetData(System::String ^ format);" />
<MemberSignature Language="C#" Value="public static object? GetData (string format);" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="windowsdesktop-10.0">
<AttributeName Language="C#">[System.Obsolete("`Clipboard.GetData(string)` method is obsolete. Use `Clipboard.TryGetData<T>` methods instead.", false, DiagnosticId="WFDEV005", UrlFormat="https://aka.ms/winforms-warnings/{0}")]</AttributeName>
<AttributeName Language="F#">[<System.Obsolete("`Clipboard.GetData(string)` method is obsolete. Use `Clipboard.TryGetData<T>` methods instead.", false, DiagnosticId="WFDEV005", UrlFormat="https://aka.ms/winforms-warnings/{0}")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="System.String" Index="0" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0;windowsdesktop-10.0" />
</Parameters>
<Docs>
<param name="format">The format of the data to retrieve. See <see cref="T:System.Windows.Forms.DataFormats" /> for predefined formats.</param>
<summary>Retrieves data from the Clipboard in the specified format.</summary>
<returns>An <see cref="T:System.Object" /> representing the Clipboard data or <see langword="null" /> if the Clipboard does not contain any data that is in the specified <paramref name="format" /> or can be converted to that format.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Windows.Forms.Clipboard.ContainsData%2A> method to determine whether the Clipboard contains data in the specified format or a compatible format before retrieving it with this method.
If this method cannot find data in the specified format, it attempts to convert the data to the format. If the data cannot be converted to the specified format, or if the data was stored with automatic conversion set to `false`, this method returns `null`.
> [!NOTE]
> Data can be converted to another format if it was stored specifying that conversion is allowed, and if the requested format is compatible with the stored format. For example, data stored as Unicode can be converted to text.
>
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
Use the <xref:System.Windows.Forms.Clipboard.SetData%2A> method to add data to the Clipboard in a particular format.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet10":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet10":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.Object" />
<altmember cref="T:System.Windows.Forms.DataFormats" />
<altmember cref="M:System.Windows.Forms.Clipboard.ContainsData(System.String)" />
<altmember cref="M:System.Windows.Forms.Clipboard.SetData(System.String,System.Object)" />
</Docs>
</Member>
<Member MemberName="GetDataObject">
<MemberSignature Language="C#" Value="public static System.Windows.Forms.IDataObject GetDataObject ();" FrameworkAlternate="netframework-1.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Windows.Forms.IDataObject GetDataObject() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.GetDataObject" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetDataObject () As IDataObject" />
<MemberSignature Language="F#" Value="static member GetDataObject : unit -> System.Windows.Forms.IDataObject" Usage="System.Windows.Forms.Clipboard.GetDataObject " />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Windows::Forms::IDataObject ^ GetDataObject();" />
<MemberSignature Language="C#" Value="public static System.Windows.Forms.IDataObject? GetDataObject ();" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Windows.Forms.IDataObject</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Retrieves the data that is currently on the system Clipboard.</summary>
<returns>An <see cref="T:System.Windows.Forms.IDataObject" /> that represents the data currently on the Clipboard, or <see langword="null" /> if there is no data on the Clipboard.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Because the data type of the object returned from the Clipboard can vary, this method returns the data in an <xref:System.Windows.Forms.IDataObject>. Then you can use methods of the <xref:System.Windows.Forms.IDataObject> interface to extract the data in its proper data type.
This method attempts to get the data ten times in 100-millisecond intervals, and throws an <xref:System.Runtime.InteropServices.ExternalException> if all attempts are unsuccessful.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following code example uses <xref:System.Windows.Forms.Clipboard> methods to place data on and retrieve it from the system Clipboard. This code assumes `button1`, `button2`, `textBox1`, and `textBox2` have been placed on the form.
The `button1_Click` method calls <xref:System.Windows.Forms.Clipboard.SetDataObject%2A> to take selected text from the text box and place it on the system Clipboard.
The `button2_Click` method calls <xref:System.Windows.Forms.Clipboard.GetDataObject%2A> to retrieve data from the system Clipboard. The code uses <xref:System.Windows.Forms.IDataObject> and <xref:System.Windows.Forms.DataFormats> to extract the data returned. The data is displayed in `textBox2`.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Overview/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic Clipboard Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">Data could not be retrieved from the Clipboard. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode and the <see cref="P:System.Windows.Forms.Application.MessageLoop" /> property value is <see langword="true" />. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.Windows.Forms.DataObject" />
<altmember cref="T:System.Windows.Forms.DataFormats" />
<altmember cref="M:System.Windows.Forms.Clipboard.SetDataObject(System.Object)" />
<altmember cref="T:System.Windows.Forms.IDataObject" />
</Docs>
</Member>
<Member MemberName="GetFileDropList">
<MemberSignature Language="C#" Value="public static System.Collections.Specialized.StringCollection GetFileDropList ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Collections.Specialized.StringCollection GetFileDropList() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.GetFileDropList" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetFileDropList () As StringCollection" />
<MemberSignature Language="F#" Value="static member GetFileDropList : unit -> System.Collections.Specialized.StringCollection" Usage="System.Windows.Forms.Clipboard.GetFileDropList " />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Collections::Specialized::StringCollection ^ GetFileDropList();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.Specialized.StringCollection</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Retrieves a collection of file names from the Clipboard.</summary>
<returns>A <see cref="T:System.Collections.Specialized.StringCollection" /> containing file names or <see langword="null" /> if the Clipboard does not contain any data that is in the <see cref="F:System.Windows.Forms.DataFormats.FileDrop" /> format or can be converted to that format.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A file drop list is a collection of strings containing path information for files.
A file drop list is stored on the Clipboard as a <xref:System.String> array. This method converts this array to a <xref:System.Collections.Specialized.StringCollection> and returns the collection.
Use the <xref:System.Windows.Forms.Clipboard.ContainsFileDropList%2A> method to determine whether the Clipboard contains a file drop list before retrieving it with this method.
Use the <xref:System.Windows.Forms.Clipboard.SetFileDropList%2A> method to add a file drop list to the Clipboard.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet30":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet30":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.Collections.Specialized.StringCollection" />
<altmember cref="F:System.Windows.Forms.DataFormats.FileDrop" />
<altmember cref="M:System.Windows.Forms.Clipboard.ContainsFileDropList" />
<altmember cref="M:System.Windows.Forms.Clipboard.SetFileDropList(System.Collections.Specialized.StringCollection)" />
</Docs>
</Member>
<Member MemberName="GetImage">
<MemberSignature Language="C#" Value="public static System.Drawing.Image GetImage ();" FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig class System.Drawing.Image GetImage() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.GetImage" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetImage () As Image" />
<MemberSignature Language="F#" Value="static member GetImage : unit -> System.Drawing.Image" Usage="System.Windows.Forms.Clipboard.GetImage " />
<MemberSignature Language="C++ CLI" Value="public:
 static System::Drawing::Image ^ GetImage();" />
<MemberSignature Language="C#" Value="public static System.Drawing.Image? GetImage ();" FrameworkAlternate="windowsdesktop-10.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Drawing.Image</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Retrieves an image from the Clipboard.</summary>
<returns>An <see cref="T:System.Drawing.Image" /> representing the Clipboard image data or <see langword="null" /> if the Clipboard does not contain any data that is in the <see cref="F:System.Windows.Forms.DataFormats.Bitmap" /> format or can be converted to that format.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Windows.Forms.Clipboard.ContainsImage%2A> method to determine whether the Clipboard contains image data before retrieving it with this method.
Use the <xref:System.Windows.Forms.Clipboard.SetImage%2A> method to add image data to the Clipboard.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet40":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet40":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.Drawing.Image" />
<altmember cref="F:System.Windows.Forms.DataFormats.Bitmap" />
<altmember cref="M:System.Windows.Forms.Clipboard.ContainsImage" />
<altmember cref="M:System.Windows.Forms.Clipboard.SetImage(System.Drawing.Image)" />
</Docs>
</Member>
<MemberGroup MemberName="GetText">
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Retrieves text data from the Clipboard.</summary>
<altmember cref="T:System.Windows.Forms.TextDataFormat" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.ContainsText" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetText" />
</Docs>
</MemberGroup>
<Member MemberName="GetText">
<MemberSignature Language="C#" Value="public static string GetText ();" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetText() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.GetText" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetText () As String" />
<MemberSignature Language="F#" Value="static member GetText : unit -> string" Usage="System.Windows.Forms.Clipboard.GetText " />
<MemberSignature Language="C++ CLI" Value="public:
 static System::String ^ GetText();" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Retrieves text data from the Clipboard in the <see cref="F:System.Windows.Forms.TextDataFormat.Text" /> or <see cref="F:System.Windows.Forms.TextDataFormat.UnicodeText" /> format, depending on the operating system.</summary>
<returns>The Clipboard text data or <see cref="F:System.String.Empty" /> if the Clipboard does not contain data in the <see cref="F:System.Windows.Forms.TextDataFormat.Text" /> or <see cref="F:System.Windows.Forms.TextDataFormat.UnicodeText" /> format, depending on the operating system.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method returns text data in the <xref:System.Windows.Forms.TextDataFormat.UnicodeText> format on Windows XP Home Edition, Windows XP Professional, Windows Server 2003 and Windows 2000. Otherwise, this method returns text data in the <xref:System.Windows.Forms.TextDataFormat.Text> format.
Use the <xref:System.Windows.Forms.Clipboard.ContainsText%2A> method to determine whether the Clipboard contains text data before retrieving it with this method.
Use the <xref:System.Windows.Forms.Clipboard.SetText%2A> method to add text data to the Clipboard.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates an overload of the <xref:System.Windows.Forms.Clipboard.GetText%2A> method that is similar to this overload.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet50":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet50":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<altmember cref="T:System.Windows.Forms.TextDataFormat" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.ContainsText" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetText" />
</Docs>
</Member>
<Member MemberName="GetText">
<MemberSignature Language="C#" Value="public static string GetText (System.Windows.Forms.TextDataFormat format);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig string GetText(valuetype System.Windows.Forms.TextDataFormat format) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.GetText(System.Windows.Forms.TextDataFormat)" />
<MemberSignature Language="VB.NET" Value="Public Shared Function GetText (format As TextDataFormat) As String" />
<MemberSignature Language="F#" Value="static member GetText : System.Windows.Forms.TextDataFormat -> string" Usage="System.Windows.Forms.Clipboard.GetText format" />
<MemberSignature Language="C++ CLI" Value="public:
 static System::String ^ GetText(System::Windows::Forms::TextDataFormat format);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="format" Type="System.Windows.Forms.TextDataFormat" Index="0" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0;windowsdesktop-10.0" />
</Parameters>
<Docs>
<param name="format">One of the <see cref="T:System.Windows.Forms.TextDataFormat" /> values.</param>
<summary>Retrieves text data from the Clipboard in the format indicated by the specified <see cref="T:System.Windows.Forms.TextDataFormat" /> value.</summary>
<returns>The Clipboard text data or <see cref="F:System.String.Empty" /> if the Clipboard does not contain data in the specified format.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
Use the <xref:System.Windows.Forms.Clipboard.ContainsText%2A> method to determine whether the Clipboard contains text data before retrieving it with this method.
Use the <xref:System.Windows.Forms.Clipboard.SetText%2A> method to add text data to the Clipboard.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates this member.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet50":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet50":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<exception cref="T:System.ComponentModel.InvalidEnumArgumentException">
<paramref name="format" /> is not a valid <see cref="T:System.Windows.Forms.TextDataFormat" /> value.</exception>
<altmember cref="T:System.Windows.Forms.TextDataFormat" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.ContainsText" />
<altmember cref="Overload:System.Windows.Forms.Clipboard.SetText" />
</Docs>
</Member>
<MemberGroup MemberName="SetAudio">
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Clears the Clipboard and then adds data in the <see cref="F:System.Windows.Forms.DataFormats.WaveAudio" /> format, replacing the existing data.</summary>
<altmember cref="F:System.Windows.Forms.DataFormats.WaveAudio" />
<altmember cref="M:System.Windows.Forms.Clipboard.ContainsAudio" />
<altmember cref="M:System.Windows.Forms.Clipboard.GetAudioStream" />
</Docs>
</MemberGroup>
<Member MemberName="SetAudio">
<MemberSignature Language="C#" Value="public static void SetAudio (byte[] audioBytes);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetAudio(unsigned int8[] audioBytes) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.SetAudio(System.Byte[])" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub SetAudio (audioBytes As Byte())" />
<MemberSignature Language="F#" Value="static member SetAudio : byte[] -> unit" Usage="System.Windows.Forms.Clipboard.SetAudio audioBytes" />
<MemberSignature Language="C++ CLI" Value="public:
 static void SetAudio(cli::array <System::Byte> ^ audioBytes);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="audioBytes" Type="System.Byte[]" Index="0" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0;windowsdesktop-10.0" />
</Parameters>
<Docs>
<param name="audioBytes">A <see cref="T:System.Byte" /> array containing the audio data.</param>
<summary>Clears the Clipboard and then adds a <see cref="T:System.Byte" /> array in the <see cref="F:System.Windows.Forms.DataFormats.WaveAudio" /> format after converting it to a <see cref="T:System.IO.Stream" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
To retrieve audio data from the Clipboard, first use the <xref:System.Windows.Forms.Clipboard.ContainsAudio%2A> method to determine whether the Clipboard contains audio data before retrieving it with the <xref:System.Windows.Forms.Clipboard.GetAudioStream%2A> method.
> [!NOTE]
> The <xref:System.Windows.Forms.Clipboard> class can only be used in threads set to single thread apartment (STA) mode. To use this class, ensure that your `Main` method is marked with the <xref:System.STAThreadAttribute> attribute.
## Examples
The following example demonstrates an overload of the <xref:System.Windows.Forms.Clipboard.SetAudio%2A> method that is similar to this overload.
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/Clipboard/Clear/form1.cs" id="Snippet20":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.Clipboard/vb/form1.vb" id="Snippet20":::
]]></format>
</remarks>
<exception cref="T:System.Runtime.InteropServices.ExternalException">The Clipboard could not be cleared. This typically occurs when the Clipboard is being used by another process.</exception>
<exception cref="T:System.Threading.ThreadStateException">The current thread is not in single-threaded apartment (STA) mode. Add the <see cref="T:System.STAThreadAttribute" /> to your application's <see langword="Main" /> method.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="audioBytes" /> is <see langword="null" />.</exception>
<altmember cref="F:System.Windows.Forms.DataFormats.WaveAudio" />
<altmember cref="M:System.Windows.Forms.Clipboard.ContainsAudio" />
<altmember cref="M:System.Windows.Forms.Clipboard.GetAudioStream" />
</Docs>
</Member>
<Member MemberName="SetAudio">
<MemberSignature Language="C#" Value="public static void SetAudio (System.IO.Stream audioStream);" />
<MemberSignature Language="ILAsm" Value=".method public static hidebysig void SetAudio(class System.IO.Stream audioStream) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.Clipboard.SetAudio(System.IO.Stream)" />
<MemberSignature Language="VB.NET" Value="Public Shared Sub SetAudio (audioStream As Stream)" />
<MemberSignature Language="F#" Value="static member SetAudio : System.IO.Stream -> unit" Usage="System.Windows.Forms.Clipboard.SetAudio audioStream" />
<MemberSignature Language="C++ CLI" Value="public:
 static void SetAudio(System::IO::Stream ^ audioStream);" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
<AssemblyVersion>5.0.0.0</AssemblyVersion>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyVersion>7.0.0.0</AssemblyVersion>
<AssemblyVersion>8.0.0.0</AssemblyVersion>
<AssemblyVersion>9.0.0.0</AssemblyVersion>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="audioStream" Type="System.IO.Stream" Index="0" FrameworkAlternate="net-5.0;net-6.0;netcore-3.0;netcore-3.1;netframework-2.0;netframework-3.0;netframework-3.5;netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;windowsdesktop-3.0;windowsdesktop-3.1;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;netframework-4.8.1;windowsdesktop-8.0;windowsdesktop-9.0;windowsdesktop-10.0" />
</Parameters>
<Docs>