C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,819 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Is it possible to highlight all rows in listbox between two index values with Visual C#?
If it possible how is it done?
For example, to highlight the items 3, 4 and 5:
int index1 = 2;
int index2 = 6;
listBox1.SelectionMode = SelectionMode.MultiExtended;
listBox1.SelectedItems.Clear( );
for( int i = index1 + 1; i < index2; i++ )
{
listBox1.SelectedIndices.Add( i );
}