Position of the item in listBox

  • Thread starter Thread starter simon
  • Start date Start date
S

simon

I have list box populated with the dataReader. Then I add one item and I
want that this item would be the first one in the listBox.
Now, It's the last. Can I change the position of the item in the listBox
from the last to the first?

lstMedia.DataSource() = funkcije.createDataReader(sql, True)
lstMedia.DataValueField = "med_id"
lstMedia.DataTextField = "med_name"
lstMedia.DataBind()

Dim novItem As New ListItem

novItem.Text = "..."
novItem.Value = "0"
novItem.Selected = True
lstMedia.Items.Add(novItem)

Thank you,

Simon
 
Just use insert !

Dim o As New MyListItem("First")

lb1.Items.Insert(0, o)

Regards - OHM



I have list box populated with the dataReader. Then I add one item
and I want that this item would be the first one in the listBox.
Now, It's the last. Can I change the position of the item in the
listBox from the last to the first?

lstMedia.DataSource() = funkcije.createDataReader(sql, True)
lstMedia.DataValueField = "med_id"
lstMedia.DataTextField = "med_name"
lstMedia.DataBind()

Dim novItem As New ListItem

novItem.Text = "..."
novItem.Value = "0"
novItem.Selected = True
lstMedia.Items.Add(novItem)

Thank you,

Simon

Regards - OHM# OneHandedMan{at}BTInternet{dot}com
 
Back
Top