I am trying to take an array of string (Filled from a listbox on a previous page and passed via Session) and display it in a label,this is how i got the array:
    Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles CheckOut.Click
    Dim x = ListBox1.GetSelectedIndices.Count
    Dim ListPNames(x) As String
    Dim i As Integer
    i = 0
    For Each item As String In ListBox1.GetSelectedIndices
        ListPNames(i) = (ListBox1.SelectedItem).ToString
        i = i + 1
    Next
    Session("SlctdPhones") = ListPNames(x)
    Response.Redirect("CheckOut.aspx")
End Sub
And this is how i am trying to display it :
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
    Dim SlctdPhones() As String = CType(Session.Item("SlctdPhones"), Array)
    Dim i As Integer
    Label3.Text = ""
    For i = 0 To SlctdPhones.Length - 1
    Label3.Text += SlctdPhones(i).ToString() + Environment.NewLine
    Next
End Sub
It is giving me an error :Object reference not set to an instance of an object. when it reaches the SlctdPhones.Length - 1 Line!! i don't know how i can fix it ,also is my array code correct(Is everything being stored correctly in it?)
 
     
    