How to make an element disappear after used?

Asked

Viewed 301 times

4

How to make an element disappear after used for example :

When you click on a button it disappears and appears something like a Listbox?

Ps1 : If the question is confused warn

Ps2 : If you can tell what to do to bring the button back up, it helps a lot

1 answer

5


You can use the methods Hide() and Show() of its elements to hide and display respectively.

button1.Hide(); //Esconde o Botão
button1.Show(); //Exibe o Botão

This can also be used for other graphic components you want

label1.Hide();
listBox1.Hide();

Therefore, just add the codes in the sequence of actions you want, as in the example cited by you:

private void button1_Click(object sender, EventArgs e)
{
    button1.Hide(); //Esconde o Botão
    listBox1.Show(); //Exibe o ListBox
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.