Skip to main content This browser is no longer supported. Show
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
ListBox.SelectedIndex Property
DefinitionIn this articleGets or sets the zero-based index of the currently selected item in a ListBox.
Property ValueInt32A zero-based index of the currently selected item. A value of negative one (-1) is returned if no item is selected. AttributesExceptionsThe assigned value is less than -1 or greater than or equal to the item count. ExamplesThe following code example demonstrates how to use the SelectedIndex property with the TopIndex property to move the currently selected item to the top of the list of items in the display area of the ListBox. The example further demonstrates how to remove items using the RemoveAt method of the System.Windows.Forms.ListBox.ObjectCollection class, and how to clear all item selection using the ClearSelected method. The code first moves the currently selected item in the ListBox to the top of the list. The code then removes all items before the currently selected item and clears all selections in the ListBox. This example requires that a ListBox containing items is added to a form and that an item is currently selected in the ListBox.
RemarksFor a standard
ListBox, you can use this property to determine the index of the item that is selected in the ListBox. If the
SelectionMode property of the ListBox is set to either To retrieve a collection containing the indexes of all selected items in a multiple-selection ListBox, use the SelectedIndices property. If you want to obtain the item that is currently selected in the ListBox, use the SelectedItem property. In addition, you can use the SelectedItems property to obtain all the selected items in a multiple-selection ListBox. Applies toSee also
This dialog is used to define a control device in the text area that can change the content of a property in an easy way. See Using Properties in the Analysis for examples of possible areas of application. For more information about how to set the options to be shown in a control, see the description for each control below. For a general description of search expressions, see Searching in TIBCO Spotfire. You cannot display more than 1000 values in a property control. However, you should try keep down the number of available values as much as possible in order to make the control easier to use.
Column selection Displays a list of columns from which you can select a column. The columns shown can be either all columns in the data table or a specified selection of columns.
Unique values in column Displays a list of the unique values available in a column. See Example of Property Controlled On-Demand Data for an example using this type of property control.
Expressions Available for string properties only. Displays a list of values obtained via more or less complex calculations. The expressions option provides a list of strings that can be used as expressions on an axis, or to define curves, etc. It is a special case of the fixed values option, and can only be used with string properties. In the example above, each option has been tied to another (numerical) property which in turn can be changed using other property controls. It is possible to copy and paste items in the list using the pop-up menu or Ctrl+C and Ctrl+V.
Fixed values Displays a list of values that you define yourself. The display name used in the control can be different from the actual value of the alternative. It is possible to copy and paste items in the list using the pop-up menu or Ctrl+C and Ctrl+V.
Numerical range Displays a range of values from min to max using a specified value interval. Can be used with numerical properties only.
See also: How to Use the Text Area What property of the ListBox control reports the number of items stored in the ListBox if the ListBox is empty the property equals 0?Items. Clear(); ListBox controls have a(n) property that reports the number of items stored in the ListBox. If the ListBox is empty, the property equals 0.
When you work with a N ___ you access data from the beginning of the file to the end of the file?When working with a sequential access file, you access its data from the beginning of the file to the end of the file. A direct access file, on the other hand, allows you to access its data from any point within the file that you choose.
Which type of data file access allows access to any piece of data in the file without reading the data that comes before it?Random access file in C enables us to read or write any data in our disk file without reading or writing every piece of data before it. In a random-access file, we may quickly search for data, edit it or even remove it.
Is used to describe a file that data is written to?The term "input file" is used to describe a file that data is written to.
|