Hi, I would change the way you are doing this. This might just be a personal preference, but I would rather load the result into a GridView then add the GridView items to the list.
Dim conn1 as Data.SqlClient.SqlConnection(STRING)
Dim SELECT1 as String
SELECT1 = "Your Select String"
Dim GridViewX as new GridView
Dim DataTableX as new data.datable
Dim Adapter1 as new Data.SqlClient.SqlDataAdapter(SELECT1, conn1)
conn1.open
Adapter1.Fill(DataTableX)
conn1.close
GridViewX.DataSource = DataTableX
GridViewX.Databind
Dim NumRows as Integer
NumRows = GridViewX.Rows.Count - 1
Dim NewItem as ?New? ListItem
Do While NumRows >=0
NewItem.Text = GridViewX.Rows(NumRows).Cells(COLUMN-NUMBER).text
NewItem.Value = GridViewX.Rows(NumRows).Cells(COLUMN-NUMBER).text
ListBox1.Items.Add(NewItem)
NumRows = NumRows - 1
Loop
That should populate the list with the items.
ericstenson
Posting Whiz in Training
Team Colleague
295 posts since Dec 2007
Reputation Points: 14
Solved Threads: 29