Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sorting Listbox (not sorted listbox)
Message
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00680258
Message ID:
00681363
Views:
25
Thank you Cathi, That'll work fine!

***** SAMPLE

You will need to create an up button and a down button as well as create a field named _moving.

Private Sub lstSample_SelectedIndexChanged(sender As Object, e As System.EventArgs)
If _moving Then
Return
End If
Dim au As Author = CType(lstSample.SelectedItem, Author)
MessageBox.Show(Me, String.Format("Name: {0}" + ControlChars.Lf + "ID: {1}", au.ToString(), au.ID), "Choice")
End Sub 'lstSample_SelectedIndexChanged


Private Sub btnUp_Click(sender As Object, e As System.EventArgs)
_moving = True
Dim i As Integer = lstSample.SelectedIndex
Dim au As Author = CType(lstSample.SelectedItem, Author)
lstSample.Items.RemoveAt(i)
lstSample.Items.Insert(i - 1, au)
lstSample.SelectedIndex = i - 1
_moving = False
End Sub 'btnUp_Click


Private Sub btnDn_Click(sender As Object, e As System.EventArgs)
_moving = True
Dim i As Integer = lstSample.SelectedIndex
Dim au As Author = CType(lstSample.SelectedItem, Author)
lstSample.Items.RemoveAt(i)
lstSample.Items.Insert(i + 1, au)
lstSample.SelectedIndex = i + 1
_moving = False
End Sub 'btnDn_Click


***** END SAMPLE
Previous
Reply
Map
View

Click here to load this message in the networking platform