How to hide WinForm in C#
By FoxLearn 6/8/2024 3:07:23 AM 8.51K
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 Get value from another Form in C#
- How to make a Notepad in C#
- How to Receive SMS from WhatsApp in C#
- How to Add Combobox to DataGridView in C#
- How to Create Multiple pages on the Form using Panel control in C#
- How to insert Math Equation to RichTextBox in C#
- How to Send and Receive email in Microsoft Outlook using C#
- How to Print Windows Form in C#
Categories
Popular Posts
How to secure ASP.NET Core with NWebSec
11/07/2024
How to create excel file in c# using dataset
11/05/2024
How to download redis for Windows
10/29/2024