Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Event handler or remoting problem?

Status
Not open for further replies.

bassguy

Programmer
Jun 21, 2001
336
US
Hello all,
just making the vb--> c# switch so forgive me if I speak VB on some terms.

I have a tcp client/server app set up with remoting.
I have an arrayList of Officers as a singleton on the server with a method that returns the Officers:

Code:
public ArrayList GetOfficers()
		{
			return myofficers;
		}

I have an event handler that calls a refresh function:

Code:
myClient.MessageReceived += new Client.MessageReceivedEventHandler( Client_MessageReceived ); 


private void Client_MessageReceived( object sender, EventArgs e ) 
{ 
     RefreshIt();
     this.listBox1.Items.Add("messaged");
}



I have a button click that calls the same function

Code:
private void button2_Click(object sender, System.EventArgs e)
{
     RefreshIt();
     this.listBox1.Items.Add("Clicked");
}



here is the refresh function

Code:
private void RefreshIt()
{
	list=myServer.GetOfficers();
	this.dataGrid1.DataSource=list;
}

ok. so there is the set up, sounds pretty straight forward.

on the button click:
refresh function is called and returns the ArrayList
then adds the text to the ListBox

on the messagerecieved event:
1. the refresh function is called
2. the ArrayList is filled (apparently the same as always)
3. the datagrid empties and acts like it is a null set
4. the debugger seems to never return to the MessageRecieved event.
5. the call to the listbox is never performed.


so, what am i missing?

any help would be appreciated

Bassguy



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top