Previous | Index | Next 

[PRB] Removing an item from a single-selectable ListBox selects the previous item

Under VB6, removing a selected item of a single-selection ListBox control has no consequences on the other items, as this code shows:

        If List1.Selected(i) Then List1.RemoveItem((i))

The same code, after the migration with VB Migration Partner, selects the previous item. In most cases this isn’t a major problem. However, if you need to perfectly replicate the VB6 behavior, you only need to replace the RemoveItem method with its .NET counterpart:

        If List1.Selected(i) Then List1.Items.RemoveAt(i)

 

Previous | Index | Next