Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Why does my background thread raise deadth of my UI?

$
0
0

Pop-UP dialog is my other common Form.

public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        private void Form1_Load(object sender, EventArgs e)        {        }        private void button1_Click(object sender, EventArgs e)        {            System.Threading.Timer tm = new System.Threading.Timer                (                (state) =>                {                    PopUpDialog ppd = new PopUpDialog();                    ppd.Show();                }, null, 0, 3000                );        }    }

U know that Timer is a background-class, BUT IT MAKE MY UI DEAD!!!!!!

Why?

If I say:

this.Text = DateTime.Now("HH:mm:ss");

instead of

PopUpDialog ppd = new PopUpDialog();
ppd.Show();

My Dialog won't be dead.

Why?

Plz explain to me in details with reflected codes, welcomed.

Thx anyway!


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>