I've created simple WindowsApplication project with one additional windwos form named Form2.
On default form I added button named button1.
And added this code
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public void button1_Click(object sender, EventArgs e)
{
noveforme nove = new noveforme(stvori);
IAsyncResult r = nove.BeginInvoke(null, null);
nove.EndInvoke(r);
}
public delegate void noveforme();
public void stvori()
{
Form2 f2 = new Form2();
f2.Show();
}
}
}
I'm trying to run that new form on separate thread.
I expected first thread to freeze and to wait until second one ends......but the opposite happens. Second thread is frozen, and first isn't.
What am I doing wrong ?