Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/11/2007, 09:17
Carliviris
 
Fecha de Ingreso: noviembre-2007
Mensajes: 21
Antigüedad: 16 años, 5 meses
Puntos: 0
Object reference not set to an instance of an object

Saludos a tod@s:

Estoy programando en ASP.NET version Visual Studio 2005, bajo el lenguaje de visual basic. Mi problema es que me sale el mensaje de error :

Cita:
Object reference not set to an instance of an object
El codigo con el cual estoy trabajando es este:

Código:
Private Sub RememberOldValues()
        Dim categoryIDList As New ArrayList
        Dim index As Integer = -1
        Dim result As New Boolean

        For Each row As GridViewRow In GridView1.Rows
            index = Convert.ToInt32(GridView1.DataKeys(row.RowIndex).Value)
            If Not IsDBNull(Session(CHECKED_ITEMS)) Then
                categoryIDList = Session(CHECKED_ITEMS)
            End If

            If result = False Then
//OJO la linea siguiente es donde me da el error//
                If Not (categoryIDList.Contains(index)) Then
                    categoryIDList.Add(index)
                End If
            Else
                categoryIDList.Remove(index)
            End If
        Next
        If Not IsDBNull(categoryIDList) And (categoryIDList.Count > 0) Then
            Session(CHECKED_ITEMS) = categoryIDList
        End If
Realmente desconozco que sucede, aunque si creo que esta sucediendo en la variable ArrayList que tengo declarada y donde puse el ojo en el codigo. Si alguien puede ayudarme, se lo agradeceria mucho.