hagbard_celine
Mitglied
Wie kann man ein neues Form in einem eigenständigen Thread Starten?
Follow along with the video below to see how to install our site as a web app on your home screen.
Anmerkung: This feature currently requires accessing the site using the built-in Safari browser.
public partial class Main : Form
{
public Main()
{
InitializeComponent();
}
private Sub Sub;
private void Start()
{
Sub = new Sub();
Thread SubThread = new Thread(new ThreadStart(Sub.ShowDialog2));
SubThread.Start();
}
private void Stop()
{
Sub.Stop();
}
}
public partial class Sub : Form
{
public Sub()
{
InitializeComponent();
}
private bool doStop;
public void Stop()
{
doStop = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
//wird alle 0,1 sek ausgeführt
if (doStop)
this.Close();
}
public void Start()
{
doStop = false;
this.ShowDialog();
}
}