works here ----- crashes here ----- So i am making this server client chat system based on message queue and in client side, i have a thread that receives messages. The name of my listbox is 'displaymsg'
here's my thread pool method
public void getmsg(object ob)
{
string msg = "";
while (true)
{
msg = mRecieve.GetMessages();
displaymsg.Items.Add(msg);
}
}
But the program is crashing when it reaches to displaymsg.Items.Add(msg) part.
To check if it is even reaching there and if it is working fine, i replaced it with MessageBox.Show(msg)
, and it is working fine, i receive every message in a pop up box that i send from other end. I'm new to wpf so kinda lost now... please help!!