Results 1 to 3 of 3

Thread: How to pass an argument from one Window Form to another?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2005
    Posts
    2

    How to pass an argument from one Window Form to another?

    Hi,

    I'm trying to pass an argument from one window form to another ... but could not do it!!! Have try declaring the variable Public and Shared to no avail. Help!!!

    What I am doing is to obtain an id from Form A --- (Click a button on Form A to open Form B) --- passing the argument to Form B so the Load event can look up data base on that id.

    Thanks

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: How to pass an argument from one Window Form to another?

    Create properties on your forms

    Kind Regards
    Jorge
    "The dark side clouds everything. Impossible to see the future is."

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to pass an argument from one Window Form to another?

    If Form A or other objects need to be able to see this value then it should be a public property of Form B, which you can set from Form A. If no other objects need to see the value then you should create a constructor for Form B that takes this value as an argument. If Form B always requires this argument then it can be the only public constructor. In this situation, I usually make the default constructor (found near the top of the auto-generated code) private and then call it from any other constructors I create. You can, of course, create a constructor and public property.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width