Dear All,
I need your help to solve below issue:-
I have an issue when I am trying to close a windows form by calling form.close() function.
The scenario is mentioned below:-
I am using a mdi form. From menu I opened a child form. Then from child form(child), I opened another form(non -child)outside the container. in non child form I am using a database insert function. After insert, I am closing the non child form and I need to re open the child form in order to reflect the data saved from non child form.
in non child form , I wrote like this:-
frmMain mainObj = new frmMain();
Close();
mainObj.OpenAssetViewForm();
And in Main form , i wrote like this to open child form within container.
- public void OpenAssetViewForm()
- {
- try
- {
- foreach (Form frmObj in Application.OpenForms)
- {
- if (frmObj.Name == "frmAssetRegView")
- {
- frmObj.Close();
- if (frmObj == null)// is not changing into null
- {
- frmObj.Show();
- }
- break;
- }
- }
- }
- catch (Exception ex)
- {
- }
- }

Bineesh ViswanathRank #3,087 · 464 reputationPosted Sep 14, 2019, 5:01 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Sep 12, 2019, 4:34 PM EDT
Bineesh ViswanathRank #3,087 · 464 reputationPosted Sep 13, 2019, 10:02 PM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Sep 13, 2019, 10:14 PM EDT
Priyanka JainRank #356 · 7K reputationPosted Sep 13, 2019, 10:36 PM EDT
Bineesh ViswanathRank #3,087 · 464 reputationPosted Sep 14, 2019, 2:13 AM EDT
Rajanikant HawaldarRank #110 · 20.2K reputationPosted Sep 14, 2019, 3:34 AM EDT
Bineesh ViswanathRank #3,087 · 464 reputationPosted Oct 5, 2019, 3:39 AM EDT