Hi
I am getting error - Cannot convert lambda expression to type 'Delegate' because it is not a delegate type
C#
dgvWindows.BeginInvoke(() =>
{
if (!_isRunning)
return;
var row = dgvWindows.Rows[dgvWindows.Rows.Add()];
row.Cells[0].Value = handle;
row.Cells[1].Value = _driver == null ? string.Empty : _driver.Title;
row.Cells[2].Value = state;
row.Cells[3].Value = $"{_duration.Hours:00}:{_duration.Minutes:00}:{_duration.Seconds:00}";
row.HeaderCell.Value = row.Index + 1;
BeginInvoke(() => Text = $"YouTube Tools - {row.Index + 1}");
});Thanks

Jithu ThomasRank #437 · 5.7K reputationPosted Apr 7, 2024, 12:28 AM EDT
dgvWindows.BeginInvoke(new MethodInvoker(() => { if (!_isRunning) return; var row = dgvWindows.Rows[dgvWindows.Rows.Add()]; row.Cells[0].Value = handle; row.Cells[1].Value = _driver == null ? string.Empty : _driver.Title; row.Cells[2].Value = state; row.Cells[3].Value = $"{_duration.Hours:00}:{_duration.Minutes:00}:{_duration.Seconds:00}"; row.HeaderCell.Value = row.Index + 1; BeginInvoke(new MethodInvoker(() => Text = $"YouTube Tools - {row.Index + 1}")); }));the above mentioned cod should address the delegate conversion error and execute as intended.