I have two modes of running my application,
one is UI mode and the other is non UI mode, I have a flag to check whether the operator is in UI or Non- ui mode.,
In non ui mode i try not to show the UI,
private void App_Load(object sender, EventArgs e)
if (!m_fUI)
//In non ui mode check for the Source mode XML or LDAP
this.Visible = false;

this.WindowState = FormWindowState.Minimized;


this.ShowInTaskbar = false;

but as soon as i change the mode the UI goes of and again pops up... Can some pls suggest how to go about

Re: Windows Forms General Hiding the UI

Bob zhu - MSFT

Hi man:

you can try follow code to see if it was you want:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Text;

using System.Windows.Forms;

namespace Test2


public partial class Form4 : Form


public Form4()



this.timer.Interval = 2000;

this.timer.Tick += new EventHandler(timer_Tick);


void timer_Tick(object sender, EventArgs e)


this.WindowState = FormWindowState.Normal;

this.Visible = true;

this.timer.Enabled = false;


private Timer timer = new Timer();

private void button1_Click(object sender, EventArgs e)


this.timer.Enabled = true;

this.Visible = false;

//this.ShowInTaskbar = false;

//this.WindowState = FormWindowState.Minimized;