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 1963 tlhintoq 3,525
Recognized Expert Specialist
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 International
Conference on Open Source Systems, OSS2005", to be held in Genova,
Italy from the 11th to the 15th of July 2005.
|
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 International
Conference on Open Source Systems, OSS2005", to be held in Genova,
Italy from the 11th to the 15th of July 2005.
|
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 form and used many
panels on the same form, which i think is easier to manage.
However, i am having problems. Should i need to put the panels on the
same location on the design layout? i put the panels at different
places and it doesn't get...
|
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, image N, the panel N becomes visible and
all the other invisible.
|
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 particular panel is invisible?
Thanks,
JJ
| |
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
to have a button-press from the right panel call a function in the left
panel, which might simply Console.Writeline(textBox1.Text);
If I could get the instance of the PanelLeft class, I could simply say:
...
|
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 within panels: It will tab though the controls outside the
panels and then, tab into the panels.
I have also tried setting the tab index at design time.
|
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 this page look like the user is moving
between many...
Here's my problem...
I started off by simply seting the visibility to true/false etc in each code
|
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 figured since all the panel data is still being sent
through the postbacks, instead of using Sessions, or HttpContext, I
could just take the values from the textboxes.
This all works fine, except for security. I realized that I could
inject...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |