I have an listbox item in my form that is changed from an class that has to be static. Due to this, I tried putting the script into an different non-static class like this:
private void addChat(string talk, string user)
{
console.Items.Add(user + ": " + talk);
}
And is ran from here:
static void OnMessage(object sender, PlayerIOClient.Message m)
{
//Code...
string username = users[m.GetInt(0)]; //public static Dictionary<int, string> users = new Dictionary<int, string>();
addChat(m.GetString(1), username);
//More code...
}
However I then get this error:
An object reference is required for the non-static field, method, or property 'NAME.Form1.addChat(string, string)'
Making this class static gives this error:
An object reference is required for the non-static field, method, or property 'NAME.Form1.console'
How do I make the console (Which is a listbox) static?