I need to make a panal in a form to be visibale=falls in a one button click.and the next button click of the same button must be make the panel visibal = falls.
and this is continuing.
can some 1 help me..
I need to make a panal in a form to be visibale=falls in a one button click.and the next button click of the same button must be make the panel visibal = falls.
and this is continuing.
can some 1 help me..
Post the code you have so far and we'll go from there!
panel1.Visible = panel1.Visible ? false : true; // toggle the on/off state of the Visible property
private void button1_Click(object sender, EventArgs e)
{
this is the only thing i have.but my algorithm is ;
if the mouse button click is equal to 1 ;
panel1.Visible = true;
else
panel1.Visible = false;
and have to have a count......
only thing is i cant implement this
why do you need a count? Is that part of a homework requirement to maintain a count?
panel1.Visible = panel1.Visible ? false : true; // toggle the on/off state of the Visible property
ya this is working but .....the panel loading speed n is very high.
so when i click the button the paneel is immediately make visible and again hide..so i cant see the panel.
nooo..this is not a home work .or a assignment. :))
so no need to have a count then.
i am just learning c#..
Attach your project so we can what you are doing.
private void button1_Click(object sender, EventArgs e)
{
panel1.Visible = !panel1.Visible;
}
Your current code runs inside of a foreach
loop which iterates the process so it flickers the visibility for every process you have running on the system. You want to toggle the visibility based on the button click and not the process iteration.
based on the button click .YA ican understand it.the thing is how to do that
It is unclear to me what it is you are trying to achieve with this program. Yes, taking the setting of the panel1.Visible
property out of the loop inside the button click will stop the flickering.
Why are you iterating through the processes anyway? You don't do anything with the information.
the thing i nee to do is when the firs click of a button the panel must be visible.
the next click of the same button must hide the panel,
again 3rd click must show the panel,
4th hide 5th show..
.....etc like that,,,
You don't explain your questions very well and you don't mark questions you have asked in the past as solved. I give up.
the thing i nee to do is when the firs click of a button the panel must be visible.
the next click of the same button must hide the panel,
again 3rd click must show the panel,
4th hide 5th show..
.....etc like that,,,
So this thread is solved then?
Because you have already been given the code to do that:
private void button1_Click(object sender, EventArgs e)
{
panel1.Visible = !panel1.Visible;
}
The code above omits the process loop you had originally, but it appears you only want to toggle the Visible
property of the panel. If the panel must be visible before first click, you need only set it that way in your form's load, where you currently have it set to false:
private void Form1_Load(object sender, EventArgs e)
{
// panel1 p1 = new Panel();
panel1.Visible = true; // instead of false
}
I've asked whether you also wanted to do something with the process loop, but you either don't need to do anything with it or you forgot to answer that question.
actualy i dont need to do much thing .....thanxx doubleD
mark this as solved please.
yaa yaa...thanx every body
You're welcome
Please mark this thread as solved if you have found an answer to your original question and good luck!
I need to make a panal in a form to be visibale=falls in a one button click.and the next button click of the same button must be make the panel visibal = falls.
and this is continuing.
can some 1 help me..
private void button1_Click(object sender, EventArgs e)
{
panel1.Visible = !panel1.Visible;
}
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.