I'm working on a windows form application and I have a button and a textbox
in it.
When the button is pressed, it should make the textbox
visible and hidden.
I'm working on a windows form application and I have a button and a textbox
in it.
When the button is pressed, it should make the textbox
visible and hidden.
Did you try Google?
textBox1.Visible = false;
You can toggle the visibility by doing:
if(textBox1.Visible == true)
textBox1.Visible = false;
else
textBox1.Visible = true;
WinForm:
private void button1_Click(object sender, System.EventArgs e)
{
textBox.Visible = !textBox.Visible;
}
WPF:
private void button1_Click(object sender, RoutedEventArgs e)
{
if (textBox.Visibility != System.Windows.Visibility.Hidden)
textBox.Visibility = System.Windows.Visibility.Hidden;
else
textBox.Visibility = System.Windows.Visibility.Visible;
}