Return a value from Form B and use it in Form A.

    Date: 04/18/06 (C Sharp)    Keywords: no keywords

    I have asked this question before, in fact. But, being a moron, I am still not able to figure out how to do this, and searching MSDN for it is getting frustrating at best. (Please explain to me how the search engine sees "delegate" and points me to 250 walkthroughs on how to write a multithreadad app.)

    I have Form A. I click a button on Form A. A dialog box, Form B, pops up. Form B contains nothing but a label, a datetimepicker, and buttons labeled OK and Cancel. The entire purpose of Form B is to get a date which it will then pass back to Form A, so Form A can use that date. For the sake of argument, we'll assign the date gotten from Form B to the variable thisDate.

    I can't simply do:
    thisDate = formB.dtpDate;

    ...because as far as form A is concerned, dtpDate doesn't exist.

    When I last asked the question, I got some tantalizing hints about delegates and event handlers. Which seems a rather complex solution (if an instance of formB is created in the code for formA, it seems to me that formA's code should then have access to the data in that instance of formB by default-- but that's just me), but if someone can walk me through it, I'd appreciate it. I get the feeling this is something I'm going to end up using hundreds of times in the various projects I'm working on.

    Thanks. And sorry for being so hard-headed.

    Source: http://community.livejournal.com/csharp/58708.html

« Вышел №56... || Myspace.com is hiring .NET... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home