public void GetQuestions(Object stateinfo) { TestRemote tr = (TestRemote)stateinfo; var questions = RemoteQuestionDAL.GetQuestions(tr.TestId); if (questions != null) { this.Invoke((MethodInvoker) delegate { listBox1.DataSource = questions.ToList <Question>(); // runs on UI thread button1.Enabled = true; button1.Text = OldText; }); } else { MessageBox.Show("No questions returned"); this.Invoke((MethodInvoker) delegate { button1.Enabled = true; button1.Text = OldText; }); } }
private void testRemoteToolStripMenuItem_Click(object sender, EventArgs e) { TestRemote tr = new TestRemote(); tr.Show(); }