locked
Passing a parameter from one form to another form. RRS feed

  • Question

  • Hi,

    I want to pass a parameter from one form to another form, return the parameter to the calling form. How can I accomplish this in C#?

    I want like this:

    from a form controls, e.g. textbox or command button, I want to invoke another form with a parameter, in Visual Foxpro, I can code it like do form frmList with x , and at the frmList Init event, I just put code like parameters x, If I want the value to be return to the calling form, I'll just put a code on frmList Unload event like Return x.

    What is the equivalent method/ events of a C# form for Init and Unload events of a Visual Foxpro form?

    TIA.

    Friday, May 12, 2006 3:38 AM

Answers

  • You can set up delgates between the forms so that an event in one form calls a method in another.  The forms have a Load and Close event which you can use, if you need to.  To pass data in, you can also pass it to the constructor, or via a property.

     

    Friday, May 12, 2006 3:43 AM

All replies

  • You can set up delgates between the forms so that an event in one form calls a method in another.  The forms have a Load and Close event which you can use, if you need to.  To pass data in, you can also pass it to the constructor, or via a property.

     

    Friday, May 12, 2006 3:43 AM
  • Can you show me please?

    Your saying that in a C# form, methods like:

    Load- can accept a parameter pass from one form, can I use it but how?

    Close - can return a parameter to the calling form.

    Are this C# method the equivalent methods a VFP form Init & Unload method?

    Again, Visual Foxpro has these methods:

    Init - Occurs when an object is created, where you can put some initialization.

    Unload - Occurs when an object is released.

    Load - Ocurrs just before an object is created.

    Destroy - Occurs when an object is released.

     

    Thanks.

    Friday, May 12, 2006 4:44 AM
  • Can you please explain yourself. I have the same problem and I cannot understand what exactly do I have to do. Thanks
    Monday, December 11, 2006 10:29 PM