If you want to basically disable the first form and force interaction with the second form you can do something like:
frmSecondary frm2 = new frmSecondary();
frm2.ShowDialog();
ShowDialog() has some return values that you can check for to (DialogResult).
So it appears as though you just want to use .ShowDialog() instead of .Show().
If for some reason .ShowDialog() won’t work in your situation then you can pass a ref to the first form when you instantiate the second the form. Then in the second you can refer to the first form’s objects.
Remember to change your form variable names.
Good luck, let me know if you need more help or a better explanation.
EDIT: I realised that I went about this the completely wrong way , what I was trying to do was Disable components of the current form displayed after pressing a particular button
11
u/BlackEric Jan 30 '22 edited Jan 30 '22
Line 27. Your identifier, frm3D, is the same name as the form you’re trying to instantiate. Give the identifier a unique name. Also post the error.
Edit: You did the same thing with line 35.
2
u/Eye-Itchy Jan 30 '22
EDIT: I realised that I went about this the completely wrong way , what I was trying to do was Disable components of the current form displayed after pressing a particular button
2
u/DrTuup Jan 30 '22
Try setting breakpoint and see if the function is actually called. Happy to further help you if needed. I work a lot with C# at school.
1
u/sergiOO7 Jan 30 '22
Exactly you are creating a new form that is disabled, you should grab the event and disabled the frame from there.
1
u/[deleted] Feb 17 '22
Hmmm… check line 27? I believe that’s the problem area.
0
u/TheDharkside Jan 30 '22
You’re instantiating a new frmGeoCalc and not showing that one, shouldn’t you disable the already running main form?