Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

server side list box

Status
Not open for further replies.

LeoLionHeart

Programmer
Apr 4, 2006
45
GB
Hi I have 2 server side list boxes and 2 buttons. Selecting a item and clicking a button will transfer the item to the other list box. The transfer all works fine. However, when i click a button, before the page is posted back a little exclaimation mark comes up in the bottom left which reads:

Line:105
Char:1
Error:Object expected
Code: 0

code for that line is
Code:
<TD style="WIDTH: 650px; HEIGHT: 166px" vAlign="top" noWrap align="left" colSpan="3">


code for server button:
Code:
Private Sub btnAddB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddB.Click
        PopulateSortCombo(Me.objAddTo, Me.objRemoveFrom)
End Sub

    Public Sub PopulateSortCombo(ByRef listFrom As ListBox, ByRef listTo As ListBox)
        Dim i As Integer = listTo.Items.Count
        Dim SortListA As ArrayList
        Dim j As Integer
        Dim k As Integer

        Do While i > 0
            If listTo.Items.Item(i - 1).Selected = True Then
                listFrom.Items.Add(listTo.Items.Item(i - 1))
                listTo.Items.Remove(listTo.Items.Item(i - 1))
                'Sort list boxes
                SortListA = New ArrayList
                For j = 0 To listFrom.Items.Count - 1
                    SortListA.Add(listFrom.Items(j).Value)
                Next 'j
                SortListA.Sort()
                listFrom.Items.Clear()
                For k = 0 To SortListA.Count - 1
                    listFrom.Items.Add(SortListA.Item(k))
                Next 'k
            End If
            i -= 1
        Loop

        For i = listFrom.Items.Count - 1 To 0 Step -1
            If listFrom.Items(i).Value = "" Then
                listFrom.Items.Remove(listFrom.Items.Item(i))
            End If
        Next

        For i = listTo.Items.Count - 1 To 0 Step -1
            If listTo.Items(i).Value = "" Then
                listTo.Items.Remove(listTo.Items.Item(i))
            End If
        Next


End Sub

Any ideas - it still works but the Error alert is shown!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top