Hi there
I have a screen which is divided by a few splitcontainers. One of them contains rectangles which user components I made, these "rectangles" represent hospital beds. What I wanted to do is give users the option to toggle between this "user component view" and a "datagrid view".
So I created a panel pnlPatients which I give the same size as the splitcontainer with the user components. When the user selects "Change view" the program is supposed to toggle between the two layouts.
Code: Attempt 1:
if (pnlPatients.Visible)
pnlPatients.Hide();
else
{
pnlPatients.Show();
pnlPatients.BringToFront();
}
Attempt 2:
pnlPatients.Visible = !pnlPatients.Visible;
pnlPatients.Invalidate();
The strange thing is that both attempts work like this:
The user first sees the "user component view". If he would toggle the view, it would correctly show the panel on top of the previous view. If he would toggle again then the panel would correctly be hidden. If he would then again toggle the view then the panel will not be shown. DO NOTE: while debugging, the visible property of the panel is correctly changed to TRUE or FALSE. But for some reason only the first time it is put to visible TRUE the panel can be seen.
Does anyone have an idea?
Best regards Clint Cambier
Edit: I also tried this but to no succes:
pnlPatients.Visible = !pnlPatients.Visible;
if (pnlPatients.Visible)
{
pnlPatients.BringToFront();
}
else
{
pnlPatients.SendToBack();
}