Answer the question
In order to leave comments, you need to log in
How to pass data from external thread to GUI thread?
There is a code:
namespace WindowsFormsApplication1Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
var dataUpdate = new DataUpdate();
dataUpdate.dE += setDataSource;
new Thread(dataUpdate.doUpdate).Start();
}
public void setDataSource( Object obj)
{
listBox1.DataSource = obj;
}
class DataUpdate
{
public delegate void DataLIStEvent(Object obj);
public event DataLIStEvent dE;
public void doUpdate()
{
var value = new List<string>();
value.Add("0.76");
dE(value);
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question