Click here to Skip to main content
15,916,318 members
Home / Discussions / C#
   

C#

 
Questionbuild vs rebuild Pin
mehrdadc4816-May-06 5:56
mehrdadc4816-May-06 5:56 
AnswerRe: build vs rebuild Pin
Rob Philpott16-May-06 5:59
Rob Philpott16-May-06 5:59 
AnswerRe: build vs rebuild Pin
Guffa16-May-06 7:09
Guffa16-May-06 7:09 
GeneralRe: build vs rebuild Pin
Robert Rohde16-May-06 8:17
Robert Rohde16-May-06 8:17 
QuestionDraw in web Pin
papa198016-May-06 5:39
papa198016-May-06 5:39 
AnswerRe: Draw in web Pin
MoustafaS16-May-06 8:02
MoustafaS16-May-06 8:02 
AnswerRe: Draw in web Pin
Jakob Farian Krarup16-May-06 8:20
Jakob Farian Krarup16-May-06 8:20 
GeneralRe: Draw in web Pin
papa198016-May-06 19:12
papa198016-May-06 19:12 
QuestionApply a codec on WAVE stream Pin
gbonnet16-May-06 5:23
gbonnet16-May-06 5:23 
AnswerRe: Apply a codec on WAVE stream Pin
martin_hughes16-May-06 12:11
martin_hughes16-May-06 12:11 
GeneralRe: Apply a codec on WAVE stream Pin
gbonnet16-May-06 22:21
gbonnet16-May-06 22:21 
GeneralRe: Apply a codec on WAVE stream Pin
gbonnet17-May-06 0:02
gbonnet17-May-06 0:02 
QuestionString Manipulation Pin
martin_hughes16-May-06 5:15
martin_hughes16-May-06 5:15 
AnswerRe: String Manipulation Pin
Paul Brower16-May-06 5:28
Paul Brower16-May-06 5:28 
GeneralRe: String Manipulation Pin
Josh Smith16-May-06 6:10
Josh Smith16-May-06 6:10 
AnswerRe: String Manipulation Pin
Guffa16-May-06 5:53
Guffa16-May-06 5:53 
AnswerRe: String Manipulation Pin
Eric Dahlvang16-May-06 6:09
Eric Dahlvang16-May-06 6:09 
AnswerRe: String Manipulation Pin
coolvinx16-May-06 11:33
coolvinx16-May-06 11:33 
AnswerRe: String Manipulation Pin
martin_hughes16-May-06 11:41
martin_hughes16-May-06 11:41 
QuestionDataGrid C# Pin
neerajsaini198216-May-06 4:09
neerajsaini198216-May-06 4:09 
QuestionHow to implement Drag'n'drop from Form to Explorer using C#?? Pin
Jakob Farian Krarup16-May-06 3:50
Jakob Farian Krarup16-May-06 3:50 
AnswerRe: How to implement Drag'n'drop from Form to Explorer using C#?? Pin
Robert Rohde16-May-06 4:07
Robert Rohde16-May-06 4:07 
GeneralRe: How to implement Drag'n'drop from Form to Explorer using C#?? Pin
Jakob Farian Krarup16-May-06 8:19
Jakob Farian Krarup16-May-06 8:19 
Questionone more question about forms ;) C# ? Pin
cmpeng3416-May-06 3:41
cmpeng3416-May-06 3:41 
AnswerRe: one more question about forms ;) C# ? Pin
Jakob Farian Krarup16-May-06 4:00
Jakob Farian Krarup16-May-06 4:00 
Hi there Mehmet

The problem you're posing is actually about encapsulation in OOP (Object Oriented Programming), so it might help you to think about it in this way:

Let's say you have two classes: A and B, and B has to be able to alter A in some way.
The only way for B to be able to alter A is if:

1) B knows A (has a reference to it)
2) A lets B access the variables B wants to change

You can accomplish part 1 by adding a constructor to form B which accepts A as a parameter and then stores a reference to A:

public class frmChangeSettings
{
    //to store a reference to the main form
    private frmTerminal _theTerminalForm;

    public frmChangeSettings(frmTerminal theMainForm)
    {
        this._theTerminalForm = theMainForm;
    }
}



You can accomplish part 2 by adding properties to frmChangeSettings

public class frmTerminal
{
    public string TextBox1sText
    {
        get {return this.TextBox1.Text;}
        set {this.TextBox1.Text = value;}
    }
    
    //.... etc for the other properties you want to be able to change
}


Then when you want to change something (for example the text in TextBox1) on from frmChangeSettings, then you just use

this._theTerminalForm.TextBox1sText = "something something"


Kind regards - Jakob Cool | :cool:
*********************************************
Three kinds of people in the world:
- Those who can count..
- Those who can't!

10 kinds of people in the world:
- Those who understand binary
- Those who don't

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.