Note that there are some explanatory texts on larger screens.

plurals
  1. POParameter count mismatch. Threading
    primarykey
    data
    text
    <p>I am trying to create a server/multi-client chat program. The client side program works perfectly. The problem is at the server's one. When I am clicking the Connect button the client should connect to the server but</p> <pre><code>An unhandled exception of type 'System.Reflection.TargetParameterCountException' occurred in mscorlib.dll Additional information: Parameter count mismatch. </code></pre> <p>comes up and the server program crashes. I am pretty sure that this happens because I want the server side program to save the client's ip and nick name into 2 ListBoxes. My events:</p> <pre><code> private void server_OnClientConnected(object Sender, ConnectedArguments R) { server.BroadCast(R.Name + " has connected."); //That message is shown at client's chat box. //So there is no problem with the connection. UpdateListbox(un_list, R.Name, false); //Here is the problem. It works when I comment out them, //without updating the list boxes of course UpdateListbox(ip_list, R.Ip, false); } </code></pre> <p>when the client is connected.</p> <pre><code> private void server_OnClientDisconnected(object Sender, DisconnectedArguments R) { server.BroadCast(R.Name + " has disconnected."); UpdateListbox(un_list,R.Name,true); UpdateListbox(ip_list, R.Ip, true); } </code></pre> <p>when the clients is disconnected.</p> <p>My method:</p> <pre><code> public delegate void UpdateList(ListBox box,object value,bool Remove); private void UpdateListbox(ListBox box, object value, bool Remove) { if (box.Dispatcher.CheckAccess()) { if (value != null &amp;&amp; Remove==false) box.Items.Add(value); else if (value != null &amp;&amp; Remove==true) box.Items.Remove(value); } else { box.Dispatcher.Invoke(new UpdateList(UpdateListbox), value); } } </code></pre> <p>Thanks in advance, George</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload