I have a simple visual c++ windows forms application, at the moment there is only one form in this project say the form is FormA, i want to add another form FormB to the current project.
Now it is required that there is a button titled as "Show FormB" on FormA.
Upon clicking this button the FormB should be visible to the user and
FormA should be disabled,
Next when the user closes the FormB, FormA should be available to the user again,
On FormB there is also some interaction with Sql-Lite database.
Any ideas/solutions will be welcomed warmly.
Thanks
[Edit] question rearranged for readability by Jibesh[/Edit]
This is a really bad idea. It looks like you want to show some sequence of forms, one at a time, like with a wizard. It can be something else. In any case, use only one form, just replace its content.
It the simplest form of it, it would be having a set of instanced of Panel filling the whole form and populated with controls you initially planned to have on each form. So a panel will represent a form content. Show only one form at a time, hide all others. Moving from one form to another one (for example, "Next") will be just hiding a visible panel and showing another one. You can design any more complex scenario.
—SA
It's not that tough to follow the steps you explained into code.
If you are displaying your FormB as Modal dialog { Form.ShowDialog() } from FormA,
just make the FormA.Visible = false;
Display Your FormB using ShowDialog
when you are done with Form
then call FormA.Visible = true;
There are other ways you can manage this UI behaviour. Its up to you and to choose whats best for you.
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)