I've looked through almost every other thread about this topic with zero results. I have a ListBox I'm using for a log display of sorts. The console updates correctly by both displaying the needed information and properly increment the size of the Items list. "Log Beginning" and "Log #2" also display properly in the ListBox. Also, the "Written" state is being reached correctly. Anybody have any ideas?
Here is my code:
public BindingList<string> Items;
public Form1()
{
Items = new BindingList<string>();
Items.Add("Log Beginning");
InitializeComponent();
Items.Add("Log #2");
LBLog.DataSource = Items;
Connect(); // leads to a websocket delcaration, irrelevant here
}
...
private void websocket_MessageReceived(object sender, MessageReceivedEventArgs e)
{
Console.WriteLine("Received " + sender.ToString() + " : " + e.ToString());
WriteLog("Log: " + e.ToString());
Console.WriteLine("Log size: " + Items.Count);
}
private void WriteLog(String msg)
{
Items.Add("test");
LBLog.DataSource = null; // tried adding these two, shouldn't need for a binding list
LBLog.DataSource = Items;
Console.WriteLine("Written");
}