Click here to Skip to main content
16,005,141 members
Home / Discussions / C#
   

C#

 
AnswerRe: Property Grid Pin
zee15-May-06 22:04
zee15-May-06 22:04 
QuestionNDOC Error Pin
For_IT3-May-06 3:17
For_IT3-May-06 3:17 
AnswerRe: NDOC Error Pin
Travis D. Mathison3-May-06 4:01
Travis D. Mathison3-May-06 4:01 
GeneralRe: NDOC Error Pin
For_IT3-May-06 4:05
For_IT3-May-06 4:05 
QuestionAccessing form objects Pin
cshivaprasad3-May-06 3:00
cshivaprasad3-May-06 3:00 
AnswerRe: Accessing form objects Pin
Travis D. Mathison3-May-06 3:51
Travis D. Mathison3-May-06 3:51 
GeneralRe: Accessing form objects Pin
cshivaprasad3-May-06 7:17
cshivaprasad3-May-06 7:17 
GeneralRe: Accessing form objects Pin
Travis D. Mathison3-May-06 7:57
Travis D. Mathison3-May-06 7:57 
Sure, so if we had a label on the form that we wanted to update by code in some other class you would do the following:

In your form code you would expose the label as a property...
delegate void Func();
...
public string MessageText
{
    get
    {
        return label1.Text;
    }
    set
    {
        Func del = delegate
        {
            label1.Text = value;
        };

        Invoke(del);
    }
}


Then we can create a new instance of the Btree class (in this case I'll just create it from the Load method of the form)
Btree myBtree = new Btree(this);


"this" refers to the Form class instance itself.. so for the constructor of the Btree class I'd have
public Btree(Form1 frm)
{
    frm.MessageText = "This is a test";
}


Since you have a reference to Form1 you can get/set properties and call methods on it. It is, however, better practice to create an interface that states what properties/methods the form should support of which other classes would make calls to so you dont tie yourself down to specific class/form names... but I dont think that would be a big concern for you at this point in time :P
QuestionProcessStartInfo And PrinterSettings Pin
sanket.mistry3-May-06 2:58
sanket.mistry3-May-06 2:58 
AnswerRe: ProcessStartInfo And PrinterSettings Pin
Ravi Bhavnani3-May-06 5:11
professionalRavi Bhavnani3-May-06 5:11 
GeneralRe: ProcessStartInfo And PrinterSettings Pin
sanket.mistry3-May-06 19:01
sanket.mistry3-May-06 19:01 
Questioncombobox.DataSource VS DataGrid.DataSource Pin
V.3-May-06 2:28
professionalV.3-May-06 2:28 
AnswerRe: combobox.DataSource VS DataGrid.DataSource Pin
therealmccoy3-May-06 5:58
therealmccoy3-May-06 5:58 
GeneralRe: combobox.DataSource VS DataGrid.DataSource Pin
V.3-May-06 21:46
professionalV.3-May-06 21:46 
Questionpublic int CurrentRowIndex { get; set; } Pin
Rmokkenstorm3-May-06 2:24
Rmokkenstorm3-May-06 2:24 
Questionhow to set the browser shortcuts to our owm browser application Pin
ranandbe3-May-06 2:22
ranandbe3-May-06 2:22 
AnswerRe: how to set the browser shortcuts to our owm browser application Pin
Travis D. Mathison3-May-06 3:20
Travis D. Mathison3-May-06 3:20 
GeneralRe: how to set the browser shortcuts to our owm browser application Pin
ranandbe3-May-06 18:54
ranandbe3-May-06 18:54 
GeneralRe: how to set the browser shortcuts to our owm browser application Pin
Travis D. Mathison3-May-06 20:25
Travis D. Mathison3-May-06 20:25 
QuestionHow to connect to Sql and ole with password ? Pin
hdv2123-May-06 2:12
hdv2123-May-06 2:12 
AnswerRe: How to connect to Sql and ole with password ? Pin
Shajeel3-May-06 2:28
Shajeel3-May-06 2:28 
Questiondatagird/com_box Pin
Amalarajan3-May-06 1:58
Amalarajan3-May-06 1:58 
AnswerRe: datagird/com_box Pin
goyal manish3-May-06 2:09
goyal manish3-May-06 2:09 
QuestionHow to call a Page as an object in a method?? Pin
ryanchopps3-May-06 0:50
ryanchopps3-May-06 0:50 
AnswerRe: How to call a Page as an object in a method?? Pin
Guffa3-May-06 3:42
Guffa3-May-06 3:42 

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.