Hello,
I would like to add rows to DataGridView from two seperate threads. I tried something with delegates and BeginInvoke but doesn't work.
Here is my row updater function which is called from another function in a thread.
public delegate void GRIDLOGDelegate(string ulke, string url, string ip = "");
private void GRIDLOG(string ulke, string url, string ip = "")
{
if (this.InvokeRequired)
{
// Pass the same function to BeginInvoke,
// but the call would come on the correct
// thread and InvokeRequired will be false.
object[] myArray = new object[3];
myArray[0] = ulke;
myArray[1] = url;
myArray[2] = ip;
this.BeginInvoke(new GRIDLOGDelegate(GRIDLOG),
new object[] { myArray });
return;
}
//Yeni bir satır daha oluştur
string[] newRow = new string[] { ulke, url, ip };
dgLogGrid.Rows.Add(newRow);
}