Click here to Skip to main content
15,922,584 members
Home / Discussions / C#
   

C#

 
GeneralRe: reguarding strings Pin
leppie10-Mar-03 8:21
leppie10-Mar-03 8:21 
GeneralRe: reguarding strings Pin
Anonymous10-Mar-03 11:05
Anonymous10-Mar-03 11:05 
GeneralAccessing vairable etc in a different class Pin
monrobot138-Mar-03 12:27
monrobot138-Mar-03 12:27 
GeneralRe: Accessing vairable etc in a different class Pin
leppie8-Mar-03 12:48
leppie8-Mar-03 12:48 
GeneralRe: Accessing vairable etc in a different class Pin
monrobot139-Mar-03 11:31
monrobot139-Mar-03 11:31 
GeneralRe: Accessing vairable etc in a different class Pin
jpwkeeper10-Mar-03 1:59
jpwkeeper10-Mar-03 1:59 
GeneralRe: Accessing vairable etc in a different class Pin
monrobot1310-Mar-03 15:42
monrobot1310-Mar-03 15:42 
GeneralRe: Accessing vairable etc in a different class Pin
jpwkeeper11-Mar-03 3:40
jpwkeeper11-Mar-03 3:40 
OK, assuming the class that needs to talk back is a member variable in your form class, you need a delegate so that the child class can push information back to the form.

Once again, let me stress that the worker class shouldn't talk directly to the controls. Let the form do that, so that when you change the form in the future (you will, even if you don't believe me now) you won't have to worry about changing the worker to match.

So, if your structure is roughly like this:
<br />
public class MyForm : //yada yada<br />
{<br />
   Private MyWorkerClass m_cMyWorker = new MyWorkerClass;<br />
   Private RichTextControl rtMyTextControl;<br />
}<br />


then you really need delegate callbacks from MyWorkerClass that MyForm hooks in to. This keeps them separate and uncoupled.

You may have to alter your intended approach a hair, but I promise you'll thank me later if you do.

Rather than explain delegates, let me point you to an incredible article Chris Sells wrote on the topic. It also talks about the evils of tight coupling (not to beat the drum too much):

http://www.codeproject.com/csharp/delegate_bedtime.asp
GeneralInherited Static Constructors Pin
moredip8-Mar-03 9:51
moredip8-Mar-03 9:51 
GeneralRe: Inherited Static Constructors Pin
Nnamdi Onyeyiri8-Mar-03 10:45
Nnamdi Onyeyiri8-Mar-03 10:45 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 11:49
moredip8-Mar-03 11:49 
GeneralRe: Inherited Static Constructors Pin
leppie8-Mar-03 12:01
leppie8-Mar-03 12:01 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 12:14
moredip8-Mar-03 12:14 
GeneralRe: Inherited Static Constructors Pin
leppie8-Mar-03 12:44
leppie8-Mar-03 12:44 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 12:56
moredip8-Mar-03 12:56 
GeneralRe: Inherited Static Constructors Pin
leppie8-Mar-03 13:14
leppie8-Mar-03 13:14 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 13:43
moredip8-Mar-03 13:43 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 13:53
moredip8-Mar-03 13:53 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 14:10
moredip8-Mar-03 14:10 
GeneralRe: Inherited Static Constructors Pin
leppie8-Mar-03 14:25
leppie8-Mar-03 14:25 
GeneralRe: Inherited Static Constructors Pin
moredip8-Mar-03 16:05
moredip8-Mar-03 16:05 
GeneralRe: Inherited Static Constructors Pin
leppie9-Mar-03 7:02
leppie9-Mar-03 7:02 
GeneralRe: Inherited Static Constructors Pin
moredip9-Mar-03 7:26
moredip9-Mar-03 7:26 
GeneralRe: Inherited Static Constructors Pin
leppie9-Mar-03 7:54
leppie9-Mar-03 7:54 
GeneralTextBox DataBinding Pin
leppie8-Mar-03 7:24
leppie8-Mar-03 7:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.