Threading question

G

Guest

I am new to threading. I have a working thread off the
System.Windows.Forms.Form main App thread. I am using the Socket to transmit
the String from a DataSet.GetXml(), reconstructing the DataSet at the other
end of the Socket. When the data comes in as a String and I assign it to a
TextBox.Text property the data shows in the TextBox without problems. When I
take the String and rebuild the DataSet and assign it to a DataGrid (please
see code below) the App freezes. Can you tell me what I am doing wrong?

On a more general level could you point to some articles or documents that
explain how data etc can be properly shared between main and working threads?

Code snippet--
private void WriteDataSet1(DataSet ds)
{
String Type,Value,TableName;
CodeJ1.ds.CellValueGet(ds,"Main","Type",out Type);
CodeJ1.ds.CellValueGet(ds,"Main","Value",out Value);
CodeJ1.ds.CellValueGet(ds,"Main","TableName",out TableName);
mDataView1 = new DataView(ds.Tables["Main"]);
dataGrid1.DataSource = mDataView1;
dataGrid1.Visible=true;
if ("Data"==Type)
{
mDataView2 = new DataView(ds.Tables["DataXY"]);
dataGrid2.DataSource = mDataView2;
dataGrid2.Visible=true;
}
}


Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top