Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Refresh control between WinForms
Message
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB 9.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01380662
Message ID:
01380859
Views:
39
>>>Is Form2 modal? Sounds like it should be. In that case, it has direct access to Form1's controls. They are all still in memory. I think you have to go into the generated part of Form1's code and change their scope from the default of private.
>>
>>IMO, its a bad idea to modify any generated code because everytime it gets regenerated you have to make your hacks again and again.
>
>I certainly agree with that. Will make some time today to play around with two test forms and see if this can be done in an un-hacky way. At this point I'm not even sure when the code for a form control gets regenerated.

Create a public form method that you call from the other form. Pass a reference from the calling for to the pop-up form via the constructor and save a reference to it. When you need to refresh the calling form just call public method. No need to mess with the generated code. The pop-up form really shouldn't be calling specific controls on the calling form anyway.

If the pop-up is modal, it's even easier. Keep the form as-is and just refresh in the calling form after the modal form call (it will block while the form is open).
-Paul

RCS Solutions, Inc.
Blog
Twitter
Previous
Reply
Map
View

Click here to load this message in the networking platform