Additional information: Type 'System.Windows.Forms.ListBox+ObjectCollection' in Assembly 'System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' is not marked as serializable.
[Serializable]
public class User_List
{
public ListBox.ObjectCollection users;
}
// Getting the Data Ready
else if (temp is BPacket.Credentials)
{
BPacket.Credentials U = (BPacket.Credentials)temp;
OnlineUsers.Items.Add(loc.ToString() + " " + U.UserName);
AllUsers[loc].UserName = U.UserName;
BPacket.User_List UL = new BPacket.User_List();
UL.users = OnlineUsers.Items;
SendOutData(UL);
}
private void SendOutData(object temp)
{
if (temp is BPacket.User_List)
{
for (int x = 0; x < NextLocation; x++)
{
formatter.Serialize(AllUsers[x].ConnStream, temp); // send data //This is where the exception is thrown
}
}
} //END SendOutData
So I want to know how to make my User_List serializable.