Click here to Skip to main content
15,884,739 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi i want to keep my collection of open forms in my app with
C#
Application.OpenForms
but when i change culture of app , Application will reset and has no collections in openForms (count =0 )!
what should i do to solve this issue?
thx for your answer:)
Posted

1 solution

One way is to create a MyForm class that derives from Form and contains a static collection which reflects the open forms. In the Shown event, the class adds it to the collection, in the Closed event it removes it.

Quite why the OpenForms collection should be empty I'm not sure - but it may have to do with the Owner changing when the culture is changed: OpenForms requires your app to be the Owner to return a valid list: https://msdn.microsoft.com/en-us/library/system.windows.forms.application.openforms(v=vs.110).aspx[^]
I haven't looked at the source code for changing culture though, so it's just a guess.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900