Visible and non Visible button by C# windows form
Today, We will learn how to make a visible and non visible program in C# windows form.
You will write only few below code for this.
first open visual studio and click New Project after that select Visual c# > Windows > Windows Forms Application You can see like below image.
Now give any Name in Name box whatever you like. After write Name , click the Ok button and after that you can see new window like below image. Now click on the toolbox and select button and choose your button design as your like. My hide button color is red and my show button color is blue.
After that double click Hide Button and write few below code
Code :-
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace hide_and_show_by_button
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
button1.Visible = false;
}
private void button2_Click(object sender, EventArgs e)
{
button1.Visible = true;
}
}
}
OUTPUT
Comments
Post a Comment
If you any doubt of any topic then you can comment me.