TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Daniel Pritchard
NA
3
2.7k
Multithreading Beginner question - Forms
Nov 12 2010 8:07 AM
Hello all,
Been reading for some time now and thought I'd post a quickie.
Why can I not open an instance of a form from within a child thread?
I can open it when not using multi threading so why can't I use threading to open a separate form?
The aim is to have one main form (form2) to do a DB update and a clock form (Clock) to display some graphics that will spiral around to show the processing time.
Please help.
Many thanks.
Dan.
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 WindowsApplication5
{
public partial class Form2 : Form
{
Thread thread1;
private bool _stopThreads = false;
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
thread1 = new Thread(new ThreadStart(DisplayThread1));
}
private void GO_Click(object sender, EventArgs e)
{
thread1.Start();
}
void DisplayThread1()
{
Clock ClockForm = new Clock();
ClockForm.Show();
}
}
}
Reply
Answers (
3
)
C# ,pdf ,sql insert and retrieve data
SubreportprocessingEvent not firing