How to retrieve a list of items from listbox in C#

Aug 15 2007 12:37 AM

Can anybody correct my codes?
I populated a listbox with emails(String).
how do i retrieve the emails from the listbox and store the emails into a studentArray??

  string[] studentArray = new string[];
     
        foreach (ListItem email in lbxMpgroup.Items)
        {
            lblStudent.Text += email.Text + "<br>";
           
             for (int i = 0; i < studentArray.Length; i++)
            {
                studentArray[i] = email.Text;
            }
        }

//When i run the above code, only the first email is stored in the array....

Thanks! =)


Answers (3)