I have a project, which used to start at Form1. Recently I was asked to create a read only version of the system (which is called ReadOnlyForm), and a login box (LoginForm) which will check permissions from the database, and depending on the user either show the ReadOnlyForm or Form1.
I don't know how to properly switch control from the LoginForm to either ReadOnlyForm or Form1. I've tried (from LoginForm):
This causes problems though because it immediately closes both windows.
This works, but when I close Form1 the hidden LoginForm is still running and the program doesn't shut down.
What is the best way to take care of this? Ideally, I would close the LoginForm, and open either Form1 or ReadOnlyForm. Any ideas?