|
105 | 105 |
|
106 | 106 | ]]></format>
|
107 | 107 | </remarks>
|
| 108 | + <exception cref="T:System.ArgumentNullException">.NET 5.0 and later: <paramref name="owner" /> is <see langword="null" />.</exception> |
108 | 109 | </Docs>
|
109 | 110 | </Member>
|
110 | 111 | <Member MemberName=".ctor">
|
|
138 | 139 |
|
139 | 140 | ]]></format>
|
140 | 141 | </remarks>
|
| 142 | + <exception cref="T:System.ArgumentNullException">.NET 5.0 and later: Either <paramref name="owner" /> or <paramref name="value" /> is <see langword="null" />.</exception> |
141 | 143 | </Docs>
|
142 | 144 | </Member>
|
143 | 145 | <Member MemberName=".ctor">
|
|
171 | 173 |
|
172 | 174 | ]]></format>
|
173 | 175 | </remarks>
|
| 176 | + <exception cref="T:System.ArgumentNullException">.NET 5.0 and later: Either <paramref name="owner" /> or <paramref name="value" /> is <see langword="null" />.</exception> |
174 | 177 | </Docs>
|
175 | 178 | </Member>
|
176 | 179 | <Member MemberName="Add">
|
|
207 | 210 | ## Remarks
|
208 | 211 | 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.
|
209 | 212 |
|
210 |
| - 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. |
211 |
| - |
212 |
| - |
| 213 | + 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. |
213 | 214 |
|
214 | 215 | ## Examples
|
215 | 216 | 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>.
|
|
221 | 222 | ]]></format>
|
222 | 223 | </remarks>
|
223 | 224 | <exception cref="T:System.SystemException">There is insufficient space available to add the new item to the list.</exception>
|
224 |
| - <exception cref="T:System.ArgumentNullException"> |
225 |
| - <paramref name="item" /> is <see langword="null" />.</exception> |
| 225 | + <exception cref="T:System.ArgumentNullException"><paramref name="item" /> is <see langword="null" />.</exception> |
226 | 226 | </Docs>
|
227 | 227 | </Member>
|
228 | 228 | <MemberGroup MemberName="AddRange">
|
|
262 | 262 | <format type="text/markdown"><![CDATA[
|
263 | 263 |
|
264 | 264 | ## Remarks
|
265 |
| - 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>. |
266 |
| - |
267 |
| - |
| 265 | + 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>. |
268 | 266 |
|
269 | 267 | ## Examples
|
270 | 268 | 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.
|
|
277 | 275 |
|
278 | 276 | ]]></format>
|
279 | 277 | </remarks>
|
| 278 | + <exception cref="T:System.ArgumentNullException">.NET 5.0 and later: <paramref name="items" /> is <see langword="null" />.</exception> |
280 | 279 | <altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Add(System.Object)" />
|
281 | 280 | </Docs>
|
282 | 281 | </Member>
|
|
314 | 313 |
|
315 | 314 | ]]></format>
|
316 | 315 | </remarks>
|
| 316 | + <exception cref="T:System.ArgumentNullException">.NET 5.0 and later: <paramref name="value" /> is <see langword="null" />.</exception> |
317 | 317 | <altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.Add(System.Object)" />
|
318 | 318 | </Docs>
|
319 | 319 | </Member>
|
|
388 | 388 |
|
389 | 389 | ]]></format>
|
390 | 390 | </remarks>
|
391 |
| - <exception cref="T:System.ArgumentNullException"> |
392 |
| - <paramref name="value" /> is <see langword="null" />.</exception> |
| 391 | + <exception cref="T:System.ArgumentNullException"><paramref name="value" /> is <see langword="null" />.</exception> |
393 | 392 | <altmember cref="M:System.Windows.Forms.ListBox.ObjectCollection.IndexOf(System.Object)" />
|
394 | 393 | <altmember cref="M:System.Windows.Forms.ListBox.FindString(System.String)" />
|
395 | 394 | <altmember cref="M:System.Windows.Forms.ListBox.FindStringExact(System.String)" />
|
|
436 | 435 |
|
437 | 436 | ]]></format>
|
438 | 437 | </remarks>
|
| 438 | + <exception cref="T:System.ArgumentNullException">.NET 5.0 and later: <paramref name="destination" /> is <see langword="null" />.</exception> |
439 | 439 | </Docs>
|
440 | 440 | </Member>
|
441 | 441 | <Member MemberName="Count">
|
|
578 | 578 | ]]></format>
|
579 | 579 | </remarks>
|
580 | 580 | <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>
|
581 |
| - <exception cref="T:System.ArgumentNullException"> |
582 |
| - <paramref name="item" /> is <see langword="null" />.</exception> |
| 581 | + <exception cref="T:System.ArgumentNullException"><paramref name="item" /> is <see langword="null" />.</exception> |
583 | 582 | </Docs>
|
584 | 583 | </Member>
|
585 | 584 | <Member MemberName="IsReadOnly">
|
|
798 | 797 | </remarks>
|
799 | 798 | <forInternalUseOnly />
|
800 | 799 | <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>
|
| 800 | + <exception cref="T:System.ArgumentNullException">.NET 5.0 and later: <paramref name="destination" /> is <see langword="null" />.</exception> |
801 | 801 | </Docs>
|
802 | 802 | </Member>
|
803 | 803 | <Member MemberName="System.Collections.ICollection.IsSynchronized">
|
|
909 | 909 | ]]></format>
|
910 | 910 | </remarks>
|
911 | 911 | <forInternalUseOnly />
|
912 |
| - <exception cref="T:System.ArgumentNullException"> |
913 |
| - <paramref name="item" /> is <see langword="null" />.</exception> |
| 912 | + <exception cref="T:System.ArgumentNullException"><paramref name="item" /> is <see langword="null" />.</exception> |
914 | 913 | <exception cref="T:System.ArgumentException">The current <see cref="T:System.Windows.Forms.ListBox" /> has a data source.</exception>
|
915 | 914 | <exception cref="T:System.SystemException">There is insufficient space available to store the new item.</exception>
|
916 | 915 | </Docs>
|
|
0 commit comments