Hi all,
Not sure if this is the right forum but here goes anyway.
I'm currently trying out some code to reproduce an application written originally in VB 6 which used ActiveX EXE's. The original application had a client (ActiveX EXE) and Manager (Windows EXE). When a user connected to the Manager it would create a new instance of the Client.
I'm trying to do the same in .NET using C#, and using a webservice as the client (not sure if that is the best way, so I'm open to comments on that!).
The webservice is very simple and just has one method currently that returns the session number.
The Manager (windows application) will, when a button is clicked, attempt to add a new session (create an instance of it) and pass it it's session number.
The problem I have is that when I request the session number from any of the instances, it always returns the last sessions number.
Manager Code below:
//DECLARED AS FOLLOWS:
private Client.Session Session1;
private Client.Session Session2;
//INSTANCIATED AS FOLLOWS
Session1 = new Client.Session();
mlngSessions=1;
Session1.Initialise(mlngSessions);
Session2 = new Client.Session();
mlngSessions=2;
Session2.Initialise(mlngSessions);
// INFORMATION READ AS FOLLOWS:
MessageBox.Show ("Response from Session " + Convert.ToString(Session1.get_SessionNumber()),"MANAGER",MessageBoxButtons.OK,MessageBoxIcon.Information);
MessageBox.Show ("Response from Session " + Convert.ToString(Session2.get_SessionNumber()),"MANAGER",MessageBoxButtons.OK,MessageBoxIcon.Information);
Client Code Below:
private static long mlngSessionNumber;
[WebMethod]
public bool Initialise(long SessionNumber)
{
mlngSessionNumber=SessionNumber;
return(true);
}
public long SessionNumber
{
[WebMethod]
get
{
return mlngSessionNumber;
}
}
Any advice greatly appreciated