943,840 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Marked Solved
  • Views: 17283
  • C# RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Aug 27th, 2008
0

Re: The name 'srvr' does not exist in the current context

Thanks I think I'm going to try using nested classes see if i can get that working. (Oh and its only 8pm here).
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Aug 27th, 2008
0

Re: The name 'srvr' does not exist in the current context

If you're not into the singleton thing, you need to think of the separation between the display and server.

Look at using events,
example when server is started, you catch the event in the notify icon and update the display properly, without having the server ever know about what is displaying in the ui portion.
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Aug 27th, 2008
0

Re: The name 'srvr' does not exist in the current context

C# Syntax (Toggle Plain Text)
  1. If you're not into the singleton thing, you need to think of the separation between the display and server.
  2.  
I dont' mind using a singleton. It just didn't work.
And I'm not sure how to do it using events.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Aug 27th, 2008
0

Re: The name 'srvr' does not exist in the current context

Quote ...
Look at using events,
example when server is started, you catch the event in the notify icon and update the display properly, without having the server ever know about what is displaying in the ui portion.
Could you give me an example of how to do that I think it sounds like the best solution.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Aug 27th, 2008
0

Re: The name 'srvr' does not exist in the current context

Here is one on Microsoft, a little technicalhttp://msdn.microsoft.com/en-us/library/aa645739(VS.71).aspx


Here is a little less technical and probably easier to follow
http://www.csharphelp.com/archives/archive253.html

Once you read them,
create the event in the server class, such OnServerStarted

in the notify class, create a server private variable and subscribe to each event

then on each event that is received, you can update your text as the event is received
Reputation Points: 133
Solved Threads: 141
Veteran Poster
dickersonka is offline Offline
1,162 posts
since Aug 2008
Aug 28th, 2008
0

Re: The name 'srvr' does not exist in the current context

If you pass server to it, any other class that uses this notify icon will require to instantiate it with server, when possibly they might not have anything to do with server.
Ok, so why not create overload methods, one for srvr.Start() and one for srvr.Stop() ?


I'm sorry but i still can't see , looking at the code so far, why it will not work . so let's say you have this in main()

Server srvr= new Server();
Notify_Icon ico=new Notify_Icon();
srvr.Start(ico);
// do something..
srvr.Stop(ico);

and in other functions you will have :

srvr.Start();
// do something..
srvr.Stop();

now... if this will not work .... then i'm missing the whole point so sorry .
Last edited by miculnegru; Aug 28th, 2008 at 3:07 am.
Reputation Points: 15
Solved Threads: 5
Light Poster
miculnegru is offline Offline
33 posts
since Nov 2005
Aug 28th, 2008
0

Re: The name 'srvr' does not exist in the current context

Click to Expand / Collapse  Quote originally posted by miculnegru ...
Ok, so why not create overload methods, one for srvr.Start() and one for srvr.Stop() ?


I'm sorry but i still can't see , looking at the code so far, why it will not work . so let's say you have this in main()

Server srvr= new Server();
Notify_Icon ico=new Notify_Icon();
srvr.Start(ico);
// do something..
srvr.Stop(ico);

and in other functions you will have :

srvr.Start();
// do something..
srvr.Stop();

now... if this will not work .... then i'm missing the whole point so sorry .
The problem was that I couldn't get the server and icon to both be able to access each others methods, but now that you show me what you ment I think it probably would have worked that way. But I've already rewritten it oh well at least it works . Thanks anyway.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
curt22 is offline Offline
56 posts
since Sep 2007
Aug 29th, 2008
0

Re: The name 'srvr' does not exist in the current context

uh.. a sorry then for the late post.. work keeped me busy.
Reputation Points: 15
Solved Threads: 5
Light Poster
miculnegru is offline Offline
33 posts
since Nov 2005

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: How to know the number of columns in the table
Next Thread in C# Forum Timeline: how to insert data...





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC