manas maadul

manas maadul

  • NA
  • 3
  • 1.5k

How can i handle multiple pannels in one button

Jul 22 2010 11:09 AM
hi

i'm tryed to develop ATM machine system and i have got trouble when i give multiple functions to button
the major problem is when i  give

 if(panel1.visible == true)
{
function1();
}

else
if((panel2.visible == true))
{
function2();
}

else
if(panel3.visible == true)
{
function3();
}
 
the button sometimes show the other panel's  functions
how can i solve this problem??


this  is the source code for 1 button



private void button8_Click(object sender, EventArgs e)
        {
            if (MPanel2.Visible == true)
            {
                MPanel2.Hide();
                MPanel1.Show();

            }
            else
                if (MPanel5.Visible == true)
                {
                    MessageBox.Show("Please eject your card", "Message", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
                }
                else
                    if (MPanel7.Visible == true)
                    {

                        MPanel9.Hide();
                        MPanel8.Hide();
                        MPanel7.Hide();
                        MPanel6.Hide();
                        MPanel5.Hide();
                        MPanel4.Hide();
                        MPanel3.Hide();
                        MPanel2.Hide();
                        MPanel1.Show();
                    }
                    else
                        if (MPanel9.Visible == true)
                        {

                            ejectCardLabel.Visible = true;

                        }
                   

        }