How to hide WinForm in C#
By FoxLearn 6/8/2024 3:07:23 AM 8.94K
In C#, you can hide a WinForm after it run by using the Hide() method of the form.
Here's how you can do it:
Open your Visual Studio, then click New Project, then select Visual C# on the left, then Windows and then select Windows Forms Application. Name your project "HideApplication" and then click OK
Open your form designer, then add a Form1_Show and Form1_Load event handlers as shown below.
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Threading; namespace HideApplication { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Shown(object sender, EventArgs e) { //Hide your windows forms application this.Hide(); } private void Form1_Load(object sender, EventArgs e) { Thread.Sleep(5000);//5s MessageBox.Show("You can't see me !", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
These methods are useful for controlling the visibility of your WinForms in C#.
VIDEO TUTORIAL
- How to update UI from another thread in C#
- How to get CheckedListBox selected values in C#
- How to use Advanced Filter DataGridView in C#
- How to create a Notification Popup in C#
- How to Use Form Load and Button click Event in C#
- How to Link Chart /Graph with Database in C#
- How to Check SQL Server Connection in C#
- How to Generate Serial Key in C#
Categories
Popular Posts
11 Things You Didn't Know About Cloudflare
12/19/2024