How to hide a form at runtime
Posted: Fri Jan 27, 2012 12:46 pm
Hello
We have created a report that has a simple form that allows the user to pick a date range then click Go (set as default and DialogResult.OK) however we would like to be able to disable the form at runtime so that the default values in the date fields are used I have tried adding
to the constructor, and that has the desired effect of removing the form however the main data band doesn't correctly bind to the data when doing this and so only a group header is printed.
Next I attempted to set the page to be Enabled = false; however that doesn't seem to do anything and the form was still rendered.
Additionally I tried adding a method to the form to immediately close the form but calling would stop the report from rendering at all, the other change I have tried is using to simulate a user click once the form had loaded but it seems to have no effect.
Is there a way to disable a form before it is shown?
Thanks
We have created a report that has a simple form that allows the user to pick a date range then click Go (set as default and DialogResult.OK) however we would like to be able to disable the form at runtime so that the default values in the date fields are used I have tried adding
Code: Select all
this.Pages.Remove(frmOptions);
Next I attempted to set the page to be Enabled = false; however that doesn't seem to do anything and the form was still rendered.
Additionally I tried adding a method to the form to immediately close the form but calling
Code: Select all
Close();
Code: Select all
btnGo.Control.PerformClick();
Is there a way to disable a form before it is shown?
Thanks