I've got this problem, i have 3 panels inside groupbox. all 3 panel are placed one over the other. when i make one of them visible, the other two SHOULD not be visible or interfere with the visible one.
The panels are started form menu strip.
But it's not working. Please, check my code, i really need advice: - using System;
-
using System.Collections.Generic;
-
using System.Drawing;
-
using System.Windows.Forms;
-
-
namespace dugma1
-
{
-
public partial class MainForm : Form
-
{
-
public MainForm()
-
{
-
InitializeComponent();
-
groupBox1.Visible=false;
-
panel1.Visible=false;
-
panel2.Visible=false;
-
panel3.Visible=false;
-
}
-
-
void N1ToolStripMenuItemClick(object sender, EventArgs e)
-
{
-
groupBox1.Visible=true; panel1.Visible=true;
-
-
panel2.Visible=false; panel3.Visible=false;
-
}
-
-
void N2ToolStripMenuItemClick(object sender, EventArgs e)
-
{
-
groupBox1.Visible=true; panel2.Visible=true;
-
-
panel1.Visible=false; panel3.Visible=false;
-
}
-
-
void N3ToolStripMenuItemClick(object sender, EventArgs e)
-
{
-
groupBox1.Visible=true; panel3.Visible=true;
-
-
panel1.Visible=false; panel2.Visible=false;
-
}
-
-
void Button1Click(object sender, EventArgs e)
-
{
-
label1.Text="ODIN";
-
}
-
-
void Button3Click(object sender, EventArgs e)
-
{
-
label2.Text="DVA!!!";
-
}
-
-
void Button5Click(object sender, EventArgs e)
-
{
-
label3.Text="SPARTA!!!!!!";
-
}
-
-
void Button2Click(object sender, EventArgs e)
-
{
-
panel1.Visible=false;
-
-
panel2.Visible=false;
-
panel3.Visible=false;
-
groupBox1.Visible=false;
-
}
-
-
void Button4Click(object sender, EventArgs e)
-
{
-
panel2.Visible=false;
-
-
panel1.Visible=false;
-
panel3.Visible=false;
-
groupBox1.Visible=false;
-
}
-
-
void Button6Click(object sender, EventArgs e)
-
{
-
panel3.Visible=false;
-
-
panel1.Visible=false;
-
panel2.Visible=false;
-
groupBox1.Visible=false;
-
}
-
}
-
}
1 1948
Tracking all the changes yourself in all those methods is a ton of work and way too easy to get confused. Not to mention a lot of work to modify if you add a fourth panel.
May I suggest you just react when any of the panels raise a .VisibleChanged event? -
void N1ToolStripMenuItemClick(object sender, EventArgs e)
-
{
-
panel1.Visible=true;
-
// The rest happens automatically from the VisibleChanged event
-
}
-
-
-
-
-
private void Panel1_VisibleChange(object sender, eventargs e)
-
{
-
Panel2.Visible = Panel3.Visible = False;
-
}
-
-
private void Panel2_VisibleChange(object sender, eventargs e)
-
{
-
Panel1.Visible = Panel3.Visible = False;
-
}
-
-
private void Panel3_VisibleChange(object sender, eventargs e)
-
{
-
Panel1.Visible = Panel2.Visible = False;
-
}
-
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: PZ |
last post by:
OSS 2005
The First International Conference on Open Source Systems
Genova, July 11 - 15, 2005
CALL FOR PANELS
http://oss2005.case.unibz.it
Submissions of panels are solicited for the "First...
|
by: PZ |
last post by:
OSS 2005
The First International Conference on Open Source Systems
Genova, July 11 - 15, 2005
CALL FOR PANELS
http://oss2005.case.unibz.it
Submissions of panels are solicited for the "First...
|
by: pfnus |
last post by:
Hi,
I want to display different forms when the buttons are clicked and all
the forms are having different controls on it. So instead of adding
new windows forms to the project, i enlarged the...
|
by: Miguel Dias Moura |
last post by:
Hello,
i have 5 panels in an ASP.net / VB page.
The panel 1 is visible the other 4 are NOT visible.
I also have 5 images: image 1, image 2, ..., image5.
When i click one of the images,...
|
by: JJ |
last post by:
Hi,
How can I lay one panel over the other? I want to switch back and forth
between panels that overlap. If I do this and make one invisible can I still
load controls with data if that...
|
by: randy1200 |
last post by:
I'm working in Visual Studio 2005 and C#.
I have a WinForms application with two panels (left panel and right panel).
I have a textbox on the left panel, and a button on the right panel. I'd like...
|
by: Ben |
last post by:
Hi
We have a number of Panels on our windows form, we have controls inside and
outside of the panels.
I am having problems tabbing between controls, it appers to be when the
controls are...
|
by: Rob Meade |
last post by:
Hi all,
I have a page, where, because it had to all be in one page there are a
multitude of panels, with the use of a handful of conditions and the ability
to show/hide panels I am able to make...
|
by: Brybot |
last post by:
I have a form that i've split up into multiple asp:panels, each panel
has a number of validators which work correctly.
At on the last panel, i want to commit the data collected to a
database. I...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |