-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
ListBox+ObjectCollection.xml
1280 lines (1217 loc) · 103 KB
/
ListBox+ObjectCollection.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="ListBox+ObjectCollection" FullName="System.Windows.Forms.ListBox+ObjectCollection">
<TypeSignature Language="C#" Value="public class ListBox.ObjectCollection : System.Collections.IList" />
<TypeSignature Language="ILAsm" Value=".class nested public auto ansi beforefieldinit ListBox/ObjectCollection extends System.Object implements class System.Collections.ICollection, class System.Collections.IEnumerable, class System.Collections.IList" />
<TypeSignature Language="DocId" Value="T:System.Windows.Forms.ListBox.ObjectCollection" />
<TypeSignature Language="VB.NET" Value="Public Class ListBox.ObjectCollection
Implements IList" />
<TypeSignature Language="F#" Value="type ListBox.ObjectCollection = class
 interface IList
 interface ICollection
 interface IEnumerable" />
<TypeSignature Language="C++ CLI" Value="public: ref class ListBox::ObjectCollection : System::Collections::IList" />
<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>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Object</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Collections.ICollection</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.IEnumerable</InterfaceName>
</Interface>
<Interface>
<InterfaceName>System.Collections.IList</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.ListBindable(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.ListBindable(false)>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="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>Represents the collection of items in a <see cref="T:System.Windows.Forms.ListBox" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.ListBox.ObjectCollection> class stores the items displayed in the <xref:System.Windows.Forms.ListBox>. There are two other collections defined within the <xref:System.Windows.Forms.ListBox> class that enable you to determine what items are selected within this collection. The <xref:System.Windows.Forms.ListBox.SelectedObjectCollection> class provides properties and methods for determining what items are selected within the <xref:System.Windows.Forms.ListBox.ObjectCollection>, while the <xref:System.Windows.Forms.ListBox.SelectedIndexCollection> class enables you to determine what indexes within the <xref:System.Windows.Forms.ListBox.ObjectCollection> are selected.
There are a number of ways to add items to the collection. The <xref:System.Windows.Forms.ListBox.ObjectCollection.Add%2A> method provides the ability to add a single object to the collection. To add a number of objects to the collection, you create an array of items and assign it to the <xref:System.Windows.Forms.ListBox.ObjectCollection.AddRange%2A> method. If you want to insert an object at a specific location within the collection, you can use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Insert%2A> method. To remove items, you can use either the <xref:System.Windows.Forms.ListBox.ObjectCollection.Remove%2A> method or the <xref:System.Windows.Forms.ListBox.ObjectCollection.RemoveAt%2A> method if you know where the item is located within the collection. The <xref:System.Windows.Forms.ListBox.ObjectCollection.Clear%2A> method enables you to remove all items from the collection instead of using the <xref:System.Windows.Forms.ListBox.ObjectCollection.Remove%2A> method to remove a single item at a time.
You can also manipulate the items of a <xref:System.Windows.Forms.ListBox> by using the <xref:System.Windows.Forms.ListControl.DataSource%2A> property. If you use the <xref:System.Windows.Forms.ListControl.DataSource%2A> property to add items to a <xref:System.Windows.Forms.ListBox>, you can view the items in the <xref:System.Windows.Forms.ListBox> using the <xref:System.Windows.Forms.ListBox.Items%2A> property but you cannot add or remove items from the list using the methods of the <xref:System.Windows.Forms.ListBox.ObjectCollection>.
In addition to methods and properties for adding and removing items, the <xref:System.Windows.Forms.ListBox.ObjectCollection> also provides methods to find items within the collection. The <xref:System.Windows.Forms.ListBox.ObjectCollection.Contains%2A> method enables you to determine whether an object is a member of the collection. Once you know that the item is located within the collection, you can use the <xref:System.Windows.Forms.ListBox.ObjectCollection.IndexOf%2A> method to determine where the item is located within the collection.
## Examples
The following code example demonstrates an owner-drawn <xref:System.Windows.Forms.ListBox> by setting the <xref:System.Windows.Forms.ListBox.DrawMode%2A> property to the `OwnerDrawVariable` value and handling the <xref:System.Windows.Forms.ListBox.DrawItem> and <xref:System.Windows.Forms.ListBox.MeasureItem> events. It also demonstrates setting the <xref:System.Windows.Forms.ListBox.BorderStyle%2A> and <xref:System.Windows.Forms.ListBox.ScrollAlwaysVisible%2A> properties and using the <xref:System.Windows.Forms.ListBox.ObjectCollection.AddRange%2A> method.
To run this example, paste it into an empty form that imports the <xref:System.Drawing> namespace and the <xref:System.Windows.Forms> namespace. Call `InitializeOwnerDrawnListBox` from the form's constructor or `Load` method.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/ListBox+ObjectCollection/Overview/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/VB/form1.vb" id="Snippet1":::
]]></format>
</remarks>
<altmember cref="T:System.Windows.Forms.ListBox.SelectedObjectCollection" />
<altmember cref="T:System.Windows.Forms.ListBox.SelectedIndexCollection" />
</Docs>
<Members>
<MemberGroup MemberName=".ctor">
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Initializes a new instance of <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" />.</summary>
</Docs>
</MemberGroup>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ObjectCollection (System.Windows.Forms.ListBox owner);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Windows.Forms.ListBox owner) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.#ctor(System.Windows.Forms.ListBox)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (owner As ListBox)" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.ListBox.ObjectCollection : System.Windows.Forms.ListBox -> System.Windows.Forms.ListBox.ObjectCollection" Usage="new System.Windows.Forms.ListBox.ObjectCollection owner" />
<MemberSignature Language="C++ CLI" Value="public:
 ObjectCollection(System::Windows::Forms::ListBox ^ owner);" />
<MemberType>Constructor</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>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters>
<Parameter Name="owner" Type="System.Windows.Forms.ListBox" />
</Parameters>
<Docs>
<param name="owner">The <see cref="T:System.Windows.Forms.ListBox" /> that owns the collection.</param>
<summary>Initializes a new instance of <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You cannot create an instance of this class without associating it with a <xref:System.Windows.Forms.ListBox> control.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">.NET 5 and later: <paramref name="owner" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ObjectCollection (System.Windows.Forms.ListBox owner, object[] value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Windows.Forms.ListBox owner, object[] value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.#ctor(System.Windows.Forms.ListBox,System.Object[])" />
<MemberSignature Language="VB.NET" Value="Public Sub New (owner As ListBox, value As Object())" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.ListBox.ObjectCollection : System.Windows.Forms.ListBox * obj[] -> System.Windows.Forms.ListBox.ObjectCollection" Usage="new System.Windows.Forms.ListBox.ObjectCollection (owner, value)" />
<MemberSignature Language="C++ CLI" Value="public:
 ObjectCollection(System::Windows::Forms::ListBox ^ owner, cli::array <System::Object ^> ^ value);" />
<MemberType>Constructor</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>
</AssemblyInfo>
<Parameters>
<Parameter Name="owner" Type="System.Windows.Forms.ListBox" />
<Parameter Name="value" Type="System.Object[]" />
</Parameters>
<Docs>
<param name="owner">The <see cref="T:System.Windows.Forms.ListBox" /> that owns the collection.</param>
<param name="value">An array of objects to add to the collection.</param>
<summary>Initializes a new instance of <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> containing an array of objects.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You cannot create an instance of this class without associating it with a <xref:System.Windows.Forms.ListBox> control.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">.NET 5 and later: Either <paramref name="owner" /> or <paramref name="value" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ObjectCollection (System.Windows.Forms.ListBox owner, System.Windows.Forms.ListBox.ObjectCollection value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(class System.Windows.Forms.ListBox owner, class System.Windows.Forms.ListBox/ObjectCollection value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.#ctor(System.Windows.Forms.ListBox,System.Windows.Forms.ListBox.ObjectCollection)" />
<MemberSignature Language="VB.NET" Value="Public Sub New (owner As ListBox, value As ListBox.ObjectCollection)" />
<MemberSignature Language="F#" Value="new System.Windows.Forms.ListBox.ObjectCollection : System.Windows.Forms.ListBox * System.Windows.Forms.ListBox.ObjectCollection -> System.Windows.Forms.ListBox.ObjectCollection" Usage="new System.Windows.Forms.ListBox.ObjectCollection (owner, value)" />
<MemberSignature Language="C++ CLI" Value="public:
 ObjectCollection(System::Windows::Forms::ListBox ^ owner, System::Windows::Forms::ListBox::ObjectCollection ^ value);" />
<MemberType>Constructor</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>
</AssemblyInfo>
<Parameters>
<Parameter Name="owner" Type="System.Windows.Forms.ListBox" />
<Parameter Name="value" Type="System.Windows.Forms.ListBox+ObjectCollection" />
</Parameters>
<Docs>
<param name="owner">The <see cref="T:System.Windows.Forms.ListBox" /> that owns the collection.</param>
<param name="value">A <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> from which the contents are copied to this collection.</param>
<summary>Initializes a new instance of <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> based on another <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You cannot create an instance of this class without associating it with a <xref:System.Windows.Forms.ListBox> control. This version of the constructor enables you to use the items specified in an existing instance of the <xref:System.Windows.Forms.ListBox.ObjectCollection> class to add items to the collection when it is created. You can use this constructor to use the items specified in another <xref:System.Windows.Forms.ListBox> control with this collection.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">.NET 5 and later: Either <paramref name="owner" /> or <paramref name="value" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Add">
<MemberSignature Language="C#" Value="public int Add (object item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 Add(object item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.Add(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Function Add (item As Object) As Integer" />
<MemberSignature Language="F#" Value="member this.Add : obj -> int" Usage="objectCollection.Add item" />
<MemberSignature Language="C++ CLI" Value="public:
 int Add(System::Object ^ item);" />
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="item" Type="System.Object" />
</Parameters>
<Docs>
<param name="item">An object representing the item to add to the collection.</param>
<summary>Adds an item to the list of items for a <see cref="T:System.Windows.Forms.ListBox" />.</summary>
<returns>The zero-based index of the item in the collection, or -1 if <see cref="M:System.Windows.Forms.ListBox.BeginUpdate" /> has been called.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the <xref:System.Windows.Forms.ListBox.Sorted%2A> property of the <xref:System.Windows.Forms.ListBox> is set to `true`, the item is inserted into the list alphabetically. Otherwise, the item is inserted at the end of the list. To insert an item into the list box at a specific position, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Insert%2A> method. To add a set of items to the list box in a single operation, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.AddRange%2A> method. If you want to use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Add%2A> method to add a large number of items to the list, use the <xref:System.Windows.Forms.ListBox.BeginUpdate%2A> and <xref:System.Windows.Forms.ListBox.EndUpdate%2A> methods to prevent the <xref:System.Windows.Forms.ListBox> from repainting each time an item is added to the list until all items are added to the list. When adding items to a <xref:System.Windows.Forms.ListBox>, it is more efficient to sort the items first and then add new items.
When an object is added to the collection, the <xref:System.Windows.Forms.ListBox> first checks to see if the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property of the <xref:System.Windows.Forms.ListControl> class has the name of a member from the object specified to reference when obtaining the item text. If the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property does not have a member specified, the <xref:System.Windows.Forms.ListBox> then calls the <xref:System.Object.ToString%2A> method of the object to obtain the text to display in the list.
## Examples
The following code example demonstrates how to create a <xref:System.Windows.Forms.ListBox> control that displays multiple items in columns and can have more than one item selected in the control's list. The code for the example adds 50 items to the <xref:System.Windows.Forms.ListBox> using the <xref:System.Windows.Forms.ListBox.ObjectCollection.Add%2A> method of the <xref:System.Windows.Forms.ListBox.ObjectCollection> class and then selects three items from the list using the <xref:System.Windows.Forms.ListBox.SetSelected%2A> method. The code then displays values from the <xref:System.Windows.Forms.ListBox.SelectedObjectCollection> collection (through the <xref:System.Windows.Forms.ListBox.SelectedItems%2A> property) and the <xref:System.Windows.Forms.ListBox.SelectedIndexCollection> (through the <xref:System.Windows.Forms.ListBox.SelectedIndices%2A> property). This example requires that the code is located in and called from a <xref:System.Windows.Forms.Form>.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/ListBox+ObjectCollection/Add/source.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/Classic ListBox Example/VB/source.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.SystemException">There is insufficient space available to add the new item to the list.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="item" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<MemberGroup MemberName="AddRange">
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Docs>
<summary>Adds a group of items to the list of items for a <see cref="T:System.Windows.Forms.ListBox" />.</summary>
</Docs>
</MemberGroup>
<Member MemberName="AddRange">
<MemberSignature Language="C#" Value="public void AddRange (object[] items);" 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;windowsdesktop-7.0;windowsdesktop-8.0" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddRange(object[] items) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.AddRange(System.Object[])" />
<MemberSignature Language="VB.NET" Value="Public Sub AddRange (items As 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;windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0" />
<MemberSignature Language="F#" Value="member this.AddRange : obj[] -> unit" Usage="objectCollection.AddRange items" />
<MemberSignature Language="C++ CLI" Value="public:
 void AddRange(cli::array <System::Object ^> ^ items);" 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;windowsdesktop-7.0;windowsdesktop-8.0" />
<MemberSignature Language="C#" Value="public void AddRange (params object[] items);" FrameworkAlternate="windowsdesktop-9.0" />
<MemberSignature Language="VB.NET" Value="Public Sub AddRange (ParamArray items As Object())" FrameworkAlternate="windowsdesktop-9.0" />
<MemberSignature Language="C++ CLI" Value="public:
 void AddRange(... cli::array <System::Object ^> ^ items);" FrameworkAlternate="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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="items" Type="System.Object[]">
<Attributes>
<Attribute FrameworkAlternate="windowsdesktop-9.0">
<AttributeName Language="C#">[System.ParamArray]</AttributeName>
<AttributeName Language="F#">[<System.ParamArray>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="items">An array of objects to add to the list.</param>
<summary>Adds an array of items to the list of items for a <see cref="T:System.Windows.Forms.ListBox" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the <xref:System.Windows.Forms.ListBox.Sorted%2A> property of the <xref:System.Windows.Forms.ListBox> is set to `true`, the items are inserted into the list alphabetically. Otherwise, the items are inserted in the order that they occur within the array. This method is typically passed an array of <xref:System.String> objects, but an array of any type of object can be passed to this method. When an object is added to the collection, the <xref:System.Windows.Forms.ListBox> first checks to see if the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property of the <xref:System.Windows.Forms.ListControl> class has the name of a member from the object specified to reference when obtaining the item text. If the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property does not have a member specified, the <xref:System.Windows.Forms.ListBox> then calls the <xref:System.Object.ToString%2A> method of the object to obtain the text to display in the list. When using this method to add items to the <xref:System.Windows.Forms.ListBox>, you do not need to call the <xref:System.Windows.Forms.ListBox.BeginUpdate%2A> and <xref:System.Windows.Forms.ListBox.EndUpdate%2A> methods to optimize performance. When adding items to a <xref:System.Windows.Forms.ListBox>, it is more efficient to sort the items first and then add new items. You can use this method to add a group of items to the list or to reuse the items stored in a different <xref:System.Windows.Forms.ListBox>.
## Examples
The following code example demonstrates an owner-drawn <xref:System.Windows.Forms.ListBox> by setting the <xref:System.Windows.Forms.ListBox.DrawMode%2A> property to the `OwnerDrawVariable` value and handling the <xref:System.Windows.Forms.ListBox.DrawItem> and <xref:System.Windows.Forms.ListBox.MeasureItem> events. It also demonstrates setting the <xref:System.Windows.Forms.ListBox.BorderStyle%2A> and <xref:System.Windows.Forms.ListBox.ScrollAlwaysVisible%2A> properties and using the <xref:System.Windows.Forms.ListBox.ObjectCollection.AddRange%2A> method.
To run this example, paste it into an empty form that imports the <xref:System.Drawing> namespace and the <xref:System.Windows.Forms> namespace. Call `InitializeOwnerDrawnListBox` from the form's constructor or `Load` method.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/ListBox+ObjectCollection/Overview/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/VB/form1.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">.NET 5 and later: <paramref name="items" /> is <see langword="null" />.</exception>
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Add(System.Object)" />
</Docs>
</Member>
<Member MemberName="AddRange">
<MemberSignature Language="C#" Value="public void AddRange (System.Windows.Forms.ListBox.ObjectCollection value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void AddRange(class System.Windows.Forms.ListBox/ObjectCollection value) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.AddRange(System.Windows.Forms.ListBox.ObjectCollection)" />
<MemberSignature Language="VB.NET" Value="Public Sub AddRange (value As ListBox.ObjectCollection)" />
<MemberSignature Language="F#" Value="member this.AddRange : System.Windows.Forms.ListBox.ObjectCollection -> unit" Usage="objectCollection.AddRange value" />
<MemberSignature Language="C++ CLI" Value="public:
 void AddRange(System::Windows::Forms::ListBox::ObjectCollection ^ value);" />
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Windows.Forms.ListBox+ObjectCollection" />
</Parameters>
<Docs>
<param name="value">A <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> to load into this collection.</param>
<summary>Adds the items of an existing <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> to the list of items in a <see cref="T:System.Windows.Forms.ListBox" />.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
If the <xref:System.Windows.Forms.ListBox.Sorted%2A> property of the <xref:System.Windows.Forms.ListBox> is set to `true`, the items are inserted into the list alphabetically. Otherwise, the items are inserted in the order that they occur within the array. This method is typically passed an array of <xref:System.String> objects, but an array of any type of object can be passed to this method. When an object is added to the collection, the <xref:System.Windows.Forms.ListBox> first checks to see if the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property of the <xref:System.Windows.Forms.ListControl> class has the name of a member from the object specified to reference when obtaining the item text. If the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property does not have a member specified, the <xref:System.Windows.Forms.ListBox> then calls the <xref:System.Object.ToString%2A> method of the object to obtain the text to display in the list.
When using this method to add items to the <xref:System.Windows.Forms.ListBox>, you do not need to call the <xref:System.Windows.Forms.ListBox.BeginUpdate%2A> and <xref:System.Windows.Forms.ListBox.EndUpdate%2A> methods to optimize performance. When adding items to a <xref:System.Windows.Forms.ListBox>, it is more efficient to sort the items first and then add new items. You can use this method to reuse the items stored in a different <xref:System.Windows.Forms.ListBox>.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">.NET 5 and later: <paramref name="value" /> is <see langword="null" />.</exception>
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Add(System.Object)" />
</Docs>
</Member>
<Member MemberName="Clear">
<MemberSignature Language="C#" Value="public virtual void Clear ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Clear() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.Clear" />
<MemberSignature Language="VB.NET" Value="Public Overridable Sub Clear ()" />
<MemberSignature Language="F#" Value="abstract member Clear : unit -> unit
override this.Clear : unit -> unit" Usage="objectCollection.Clear " />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void Clear();" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Clear</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Removes all items from the collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you remove items from the list, all information about the deleted items is lost. To remove a single item from the <xref:System.Windows.Forms.ListBox>, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Remove%2A> or <xref:System.Windows.Forms.ListBox.ObjectCollection.RemoveAt%2A> method.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Contains">
<MemberSignature Language="C#" Value="public bool Contains (object value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance bool Contains(object value) cil managed" 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" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.Contains(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Function Contains (value As Object) As Boolean" />
<MemberSignature Language="F#" Value="abstract member Contains : obj -> bool
override this.Contains : obj -> bool" Usage="objectCollection.Contains value" 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" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual bool Contains(System::Object ^ value);" 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" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance bool Contains(object value) cil managed" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.Contains : obj -> bool" Usage="objectCollection.Contains value" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="C++ CLI" Value="public:
 bool Contains(System::Object ^ value);" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember 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">M:System.Collections.IList.Contains(System.Object)</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">An object representing the item to locate in the collection.</param>
<summary>Determines whether the specified item is located within the collection.</summary>
<returns>
<see langword="true" /> if the item is located within the collection; otherwise, <see langword="false" />.</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.ListBox.ObjectCollection.Contains%2A> method enables you to determine whether an object is a member of the collection. Once you know that the item is located within the collection, you can use the <xref:System.Windows.Forms.ListBox.ObjectCollection.IndexOf%2A> method to determine where the item is located within the collection.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="value" /> is <see langword="null" />.</exception>
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.IndexOf(System.Object)" />
<altmember cref="M:System.Windows.Forms.ListBox.FindString(System.String)" />
<altmember cref="M:System.Windows.Forms.ListBox.FindStringExact(System.String)" />
</Docs>
</Member>
<Member MemberName="CopyTo">
<MemberSignature Language="C#" Value="public void CopyTo (object[] dest, int arrayIndex);" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void CopyTo(object[] dest, int32 arrayIndex) cil managed" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.CopyTo(System.Object[],System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub CopyTo (dest As Object(), arrayIndex As Integer)" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="F#" Value="member this.CopyTo : obj[] * int -> unit" Usage="objectCollection.CopyTo (dest, arrayIndex)" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="C++ CLI" Value="public:
 void CopyTo(cli::array <System::Object ^> ^ dest, int arrayIndex);" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="C#" Value="public void CopyTo (object[] destination, int arrayIndex);" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void CopyTo(object[] destination, int32 arrayIndex) cil managed" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="VB.NET" Value="Public Sub CopyTo (destination As Object(), arrayIndex As Integer)" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.CopyTo : obj[] * int -> unit" Usage="objectCollection.CopyTo (destination, arrayIndex)" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="C++ CLI" Value="public:
 void CopyTo(cli::array <System::Object ^> ^ destination, int arrayIndex);" 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;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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dest" Type="System.Object[]" Index="0" FrameworkAlternate="netframework-1.1" />
<Parameter Name="destination" Type="System.Object[]" Index="0" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<Parameter Name="arrayIndex" Type="System.Int32" Index="1" />
</Parameters>
<Docs>
<param name="dest">The object array to which the items from the collection are copied.</param>
<param name="destination">The object array to which the items from the collection are copied.</param>
<param name="arrayIndex">The location within the destination array to copy the items from the collection to.</param>
<summary>Copies the entire collection into an existing array of objects at a specified location within the array.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this method to combine the items from multiple collections into a single array. You can then use this array to populate the contents of another <xref:System.Windows.Forms.ListBox> control using the <xref:System.Windows.Forms.ListBox.ObjectCollection.AddRange%2A> method of the <xref:System.Windows.Forms.ListBox.ObjectCollection> class.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">.NET 5 and later: <paramref name="destination" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="Count">
<MemberSignature Language="C#" Value="public int Count { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance int32 Count" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.ListBox.ObjectCollection.Count" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property Count As Integer" />
<MemberSignature Language="F#" Value="member this.Count : int" Usage="System.Windows.Forms.ListBox.ObjectCollection.Count" />
<MemberSignature Language="C++ CLI" Value="public:
 property int Count { int get(); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.ICollection.Count</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the number of items in the collection.</summary>
<value>The number of items in the collection.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property enables you to determine the number of items in the <xref:System.Windows.Forms.ListBox>. You can then use this value when you are looping through the values of the collection and you need to provide a number of iterations to perform the loop.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="GetEnumerator">
<MemberSignature Language="C#" Value="public System.Collections.IEnumerator GetEnumerator ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class System.Collections.IEnumerator GetEnumerator() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.GetEnumerator" />
<MemberSignature Language="VB.NET" Value="Public Function GetEnumerator () As IEnumerator" />
<MemberSignature Language="F#" Value="abstract member GetEnumerator : unit -> System.Collections.IEnumerator
override this.GetEnumerator : unit -> System.Collections.IEnumerator" Usage="objectCollection.GetEnumerator " />
<MemberSignature Language="C++ CLI" Value="public:
 virtual System::Collections::IEnumerator ^ GetEnumerator();" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IEnumerable.GetEnumerator</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.IEnumerator</ReturnType>
</ReturnValue>
<Parameters />
<Docs>
<summary>Returns an enumerator to use to iterate through the item collection.</summary>
<returns>An <see cref="T:System.Collections.IEnumerator" /> that represents the item collection.</returns>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="IndexOf">
<MemberSignature Language="C#" Value="public int IndexOf (object value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance int32 IndexOf(object value) cil managed" 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" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.IndexOf(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Function IndexOf (value As Object) As Integer" />
<MemberSignature Language="F#" Value="abstract member IndexOf : obj -> int
override this.IndexOf : obj -> int" Usage="objectCollection.IndexOf value" 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" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual int IndexOf(System::Object ^ value);" 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" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance int32 IndexOf(object value) cil managed" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.IndexOf : obj -> int" Usage="objectCollection.IndexOf value" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="C++ CLI" Value="public:
 int IndexOf(System::Object ^ value);" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember 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">M:System.Collections.IList.IndexOf(System.Object)</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Int32</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">An object representing the item to locate in the collection.</param>
<summary>Returns the index within the collection of the specified item.</summary>
<returns>The zero-based index where the item is located within the collection; otherwise, negative one (-1).</returns>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The <xref:System.Windows.Forms.ListBox.ObjectCollection.IndexOf%2A> method enables you to determine where an item is located within the collection. To determine whether an item is located within the collection before calling this method, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Contains%2A> method.
]]></format>
</remarks>
<exception cref="T:System.ArgumentNullException">The <paramref name="value" /> parameter is null.</exception>
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Contains(System.Object)" />
</Docs>
</Member>
<Member MemberName="Insert">
<MemberSignature Language="C#" Value="public void Insert (int index, object item);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Insert(int32 index, object item) cil managed" 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" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.Insert(System.Int32,System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Sub Insert (index As Integer, item As Object)" />
<MemberSignature Language="F#" Value="abstract member Insert : int * obj -> unit
override this.Insert : int * obj -> unit" Usage="objectCollection.Insert (index, item)" 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" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void Insert(int index, System::Object ^ item);" 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" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Insert(int32 index, object item) cil managed" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.Insert : int * obj -> unit" Usage="objectCollection.Insert (index, item)" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="C++ CLI" Value="public:
 void Insert(int index, System::Object ^ item);" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember 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">M:System.Collections.IList.Insert(System.Int32,System.Object)</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
<Parameter Name="item" Type="System.Object" />
</Parameters>
<Docs>
<param name="index">The zero-based index location where the item is inserted.</param>
<param name="item">An object representing the item to insert.</param>
<summary>Inserts an item into the list box at the specified index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method enables you to insert an item at a specific position within the <xref:System.Windows.Forms.ListBox>. If the <xref:System.Windows.Forms.ListBox.Sorted%2A> property of the <xref:System.Windows.Forms.ListBox> is set to true, the item is added in the correct position within the sorted list regardless of the values specified in the `index` parameter. When an object is added to the collection, the <xref:System.Windows.Forms.ListBox> first checks to see if the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property of the <xref:System.Windows.Forms.ListControl> class has the name of a member from the object specified to reference when obtaining the item text. If the <xref:System.Windows.Forms.ListControl.DisplayMember%2A> property does not have a member specified, the <xref:System.Windows.Forms.ListBox> then calls the <xref:System.Object.ToString%2A> method of the object to obtain the text to display in the list.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="index" /> parameter is less than zero or greater than value of the <see cref="P:System.Windows.Forms.ListBox.ObjectCollection.Count" /> property of the <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> class.</exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="item" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="IsReadOnly">
<MemberSignature Language="C#" Value="public bool IsReadOnly { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsReadOnly" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.ListBox.ObjectCollection.IsReadOnly" />
<MemberSignature Language="VB.NET" Value="Public ReadOnly Property IsReadOnly As Boolean" />
<MemberSignature Language="F#" Value="member this.IsReadOnly : bool" Usage="System.Windows.Forms.ListBox.ObjectCollection.IsReadOnly" />
<MemberSignature Language="C++ CLI" Value="public:
 property bool IsReadOnly { bool get(); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.IList.IsReadOnly</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a value indicating whether the collection is read-only.</summary>
<value>
<see langword="true" /> if this collection is read-only; otherwise, <see langword="false" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This property is always `false` for this collection.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="Item">
<MemberSignature Language="C#" Value="public virtual object this[int index] { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance object Item(int32)" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.ListBox.ObjectCollection.Item(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Default Public Overridable Property Item(index As Integer) As Object" />
<MemberSignature Language="F#" Value="member this.Item(int) : obj with get, set" Usage="System.Windows.Forms.ListBox.ObjectCollection.Item" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual property System::Object ^ default[int] { System::Object ^ get(int index); void set(int index, System::Object ^ value); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember 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">P:System.Collections.IList.Item(System.Int32)</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.Browsable(false)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Browsable(false)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="index">The index of the item in the collection to get or set.</param>
<summary>Gets or sets the item at the specified index within the collection.</summary>
<value>An object representing the item located at the specified index within the collection.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
You can use this method to obtain the <xref:System.Windows.Forms.ListBox> item stored at a specific location within the collection. To determine the index of a specific item within the collection, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.IndexOf%2A> method.
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="index" /> parameter is less than zero or greater than or equal to the value of the <see cref="P:System.Windows.Forms.ListBox.ObjectCollection.Count" /> property of the <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> class.</exception>
</Docs>
</Member>
<Member MemberName="Remove">
<MemberSignature Language="C#" Value="public void Remove (object value);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void Remove(object value) cil managed" 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" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.Remove(System.Object)" />
<MemberSignature Language="VB.NET" Value="Public Sub Remove (value As Object)" />
<MemberSignature Language="F#" Value="abstract member Remove : obj -> unit
override this.Remove : obj -> unit" Usage="objectCollection.Remove value" 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" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void Remove(System::Object ^ value);" 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" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig instance void Remove(object value) cil managed" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="member this.Remove : obj -> unit" Usage="objectCollection.Remove value" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="C++ CLI" Value="public:
 void Remove(System::Object ^ value);" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember 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">M:System.Collections.IList.Remove(System.Object)</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="value" Type="System.Object" />
</Parameters>
<Docs>
<param name="value">An object representing the item to remove from the collection.</param>
<summary>Removes the specified object from the collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you remove an item from the list, the indexes change for subsequent items in the list. All information about the removed item is deleted. You can use this method to remove a specific item from the list by specifying the actual item to remove from the list. To specify the index of the item to remove instead of the item itself, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.RemoveAt%2A> method. To remove all items from the list, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Clear%2A> method.
]]></format>
</remarks>
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Clear" />
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.RemoveAt(System.Int32)" />
</Docs>
</Member>
<Member MemberName="RemoveAt">
<MemberSignature Language="C#" Value="public void RemoveAt (int index);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance void RemoveAt(int32 index) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.RemoveAt(System.Int32)" />
<MemberSignature Language="VB.NET" Value="Public Sub RemoveAt (index As Integer)" />
<MemberSignature Language="F#" Value="abstract member RemoveAt : int -> unit
override this.RemoveAt : int -> unit" Usage="objectCollection.RemoveAt index" />
<MemberSignature Language="C++ CLI" Value="public:
 virtual void RemoveAt(int index);" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.RemoveAt(System.Int32)</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="index" Type="System.Int32" />
</Parameters>
<Docs>
<param name="index">The zero-based index of the item to remove.</param>
<summary>Removes the item at the specified index within the collection.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
When you remove an item from the list, the indexes change for subsequent items in the list. All information about the removed item is deleted. You can use this method to remove a specific item from the list by specifying the index of the item to remove from the list. To specify the item to remove instead of the index to the item, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Remove%2A> method. To remove all items from the list, use the <xref:System.Windows.Forms.ListBox.ObjectCollection.Clear%2A> method.
## Examples
The following code example demonstrates how to use the <xref:System.Windows.Forms.ListBox.SelectedIndex%2A> property with the <xref:System.Windows.Forms.ListBox.TopIndex%2A> property to move the currently selected item to the top of the list of items in the display area of the <xref:System.Windows.Forms.ListBox>. The example further demonstrates how to remove items using the <xref:System.Windows.Forms.ListBox.ObjectCollection.RemoveAt%2A> method of the <xref:System.Windows.Forms.ListBox.ObjectCollection?displayProperty=nameWithType> class, and how to clear all item selection using the <xref:System.Windows.Forms.ListBox.ClearSelected%2A> method. The code first moves the currently selected item in the <xref:System.Windows.Forms.ListBox> to the top of the list. The code then removes all items before the currently selected item and clears all selections in the <xref:System.Windows.Forms.ListBox>. This example requires that a <xref:System.Windows.Forms.ListBox> containing items is added to a form and that an item is currently selected in the <xref:System.Windows.Forms.ListBox>.
:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp" id="Snippet1":::
:::code language="csharp" source="~/snippets/csharp/System.Windows.Forms/ListBox+ObjectCollection/RemoveAt/form1.cs" id="Snippet1":::
:::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Winforms/ListBox.SelectedIndex/VB/form1.vb" id="Snippet1":::
]]></format>
</remarks>
<exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="index" /> parameter is less than zero or greater than or equal to the value of the <see cref="P:System.Windows.Forms.ListBox.ObjectCollection.Count" /> property of the <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" /> class.</exception>
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Clear" />
<altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Remove(System.Object)" />
</Docs>
</Member>
<Member MemberName="System.Collections.ICollection.CopyTo">
<MemberSignature Language="C#" Value="void ICollection.CopyTo (Array dest, int index);" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.ICollection.CopyTo(class System.Array dest, int32 index) cil managed" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.System#Collections#ICollection#CopyTo(System.Array,System.Int32)" />
<MemberSignature Language="VB.NET" Value="Sub CopyTo (dest As Array, index As Integer) Implements ICollection.CopyTo" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="F#" Value="abstract member System.Collections.ICollection.CopyTo : Array * int -> unit
override this.System.Collections.ICollection.CopyTo : Array * int -> unit" Usage="objectCollection.System.Collections.ICollection.CopyTo (dest, index)" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Collections.ICollection.CopyTo(Array ^ dest, int index) = System::Collections::ICollection::CopyTo;" FrameworkAlternate="netframework-1.1" />
<MemberSignature Language="C#" Value="void ICollection.CopyTo (Array destination, int index);" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance void System.Collections.ICollection.CopyTo(class System.Array destination, int32 index) cil managed" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="VB.NET" Value="Sub CopyTo (destination As Array, index As Integer) Implements ICollection.CopyTo" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="F#" Value="abstract member System.Collections.ICollection.CopyTo : Array * int -> unit
override this.System.Collections.ICollection.CopyTo : Array * int -> unit" Usage="objectCollection.System.Collections.ICollection.CopyTo (destination, index)" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberSignature Language="C++ CLI" Value=" virtual void System.Collections.ICollection.CopyTo(Array ^ destination, int index) = System::Collections::ICollection::CopyTo;" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.ICollection.CopyTo(System.Array,System.Int32)</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Void</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="dest" Type="System.Array" Index="0" FrameworkAlternate="netframework-1.1" />
<Parameter Name="destination" Type="System.Array" Index="0" 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;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<Parameter Name="index" Type="System.Int32" Index="1" />
</Parameters>
<Docs>
<param name="dest">The one-dimensional array that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The array must have zero-based indexing.</param>
<param name="destination">The one-dimensional array that is the destination of the elements copied from <see cref="T:System.Collections.ICollection" />. The array must have zero-based indexing.</param>
<param name="index">The zero-based index in the array at which copying begins.</param>
<summary>Copies the elements of the collection to an array, starting at a particular array index.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This member is an explicit interface member implementation. It can be used only when the <xref:System.Windows.Forms.ListBox.ObjectCollection> instance is cast to an <xref:System.Collections.ICollection> interface.
]]></format>
</remarks>
<forInternalUseOnly />
<exception cref="T:System.ArrayTypeMismatchException">The array type is not compatible with the items in the <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" />.</exception>
<exception cref="T:System.ArgumentNullException">.NET 5 and later: <paramref name="destination" /> is <see langword="null" />.</exception>
</Docs>
</Member>
<Member MemberName="System.Collections.ICollection.IsSynchronized">
<MemberSignature Language="C#" Value="bool System.Collections.ICollection.IsSynchronized { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool System.Collections.ICollection.IsSynchronized" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.ListBox.ObjectCollection.System#Collections#ICollection#IsSynchronized" />
<MemberSignature Language="VB.NET" Value=" ReadOnly Property IsSynchronized As Boolean Implements ICollection.IsSynchronized" />
<MemberSignature Language="F#" Value="member this.System.Collections.ICollection.IsSynchronized : bool" Usage="System.Collections.ICollection.IsSynchronized" />
<MemberSignature Language="C++ CLI" Value="property bool System::Collections::ICollection::IsSynchronized { bool get(); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.ICollection.IsSynchronized</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>For a description of this member, see <see cref="P:System.Collections.ICollection.IsSynchronized" />.</summary>
<value>
<see langword="false" /> in all cases.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This member is an explicit interface member implementation. It can be used only when the <xref:System.Windows.Forms.ListBox.ObjectCollection> instance is cast to an <xref:System.Collections.ICollection> interface.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.Collections.ICollection.SyncRoot">
<MemberSignature Language="C#" Value="object System.Collections.ICollection.SyncRoot { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance object System.Collections.ICollection.SyncRoot" />
<MemberSignature Language="DocId" Value="P:System.Windows.Forms.ListBox.ObjectCollection.System#Collections#ICollection#SyncRoot" />
<MemberSignature Language="VB.NET" Value=" ReadOnly Property SyncRoot As Object Implements ICollection.SyncRoot" />
<MemberSignature Language="F#" Value="member this.System.Collections.ICollection.SyncRoot : obj" Usage="System.Collections.ICollection.SyncRoot" />
<MemberSignature Language="C++ CLI" Value="property System::Object ^ System::Collections::ICollection::SyncRoot { System::Object ^ get(); };" />
<MemberType>Property</MemberType>
<Implements>
<InterfaceMember>P:System.Collections.ICollection.SyncRoot</InterfaceMember>
</Implements>
<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>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Object</ReturnType>
</ReturnValue>
<Docs>
<summary>For a description of this member, see <see cref="P:System.Collections.ICollection.SyncRoot" />.</summary>
<value>An object that can be used to synchronize access to the <see cref="T:System.Windows.Forms.ListBox.ObjectCollection" />.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This member is an explicit interface member implementation. It can be used only when the <xref:System.Windows.Forms.ListBox.ObjectCollection> instance is cast to an <xref:System.Collections.ICollection> interface.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="System.Collections.IList.Add">
<MemberSignature Language="C#" Value="int IList.Add (object item);" 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" />
<MemberSignature Language="ILAsm" Value=".method hidebysig newslot virtual instance int32 System.Collections.IList.Add(object item) cil managed" />
<MemberSignature Language="DocId" Value="M:System.Windows.Forms.ListBox.ObjectCollection.System#Collections#IList#Add(System.Object)" />
<MemberSignature Language="VB.NET" Value="Function Add (item As Object) As Integer Implements IList.Add" />
<MemberSignature Language="F#" Value="abstract member System.Collections.IList.Add : obj -> int
override this.System.Collections.IList.Add : obj -> int" Usage="objectCollection.System.Collections.IList.Add item" />
<MemberSignature Language="C++ CLI" Value=" virtual int System.Collections.IList.Add(System::Object ^ item) = System::Collections::IList::Add;" />
<MemberSignature Language="C#" Value="int IList.Add (object? item);" FrameworkAlternate="windowsdesktop-5.0;windowsdesktop-6.0;windowsdesktop-7.0;windowsdesktop-8.0;windowsdesktop-9.0" />
<MemberType>Method</MemberType>
<Implements>
<InterfaceMember>M:System.Collections.IList.Add(System.Object)</InterfaceMember>
</Implements>
<AssemblyInfo>
<AssemblyName>System.Windows.Forms</AssemblyName>
<AssemblyVersion>1.0.5000.0</AssemblyVersion>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>