I have some problem when trying to get value of combobox in IF statement in Backgroundworker. When I try to run this code
if (KondisiSaldo.SelectedItem == "Kurang dari...")
{
view.RowFilter = string.Format("[Saldo] < '{0}'", thresholdcas);
view2.RowFilter = string.Format("[Saldo] > '{0}'", thresholdcas);
this.Invoke(new MethodInvoker(delegate
{
ViewDataSaldoGV.DataSource = view;
SaldoUnscheduleGV.DataSource = view2;
}));
}
The error says
Cross-thread operation not valid: Control 'KondisiSaldo' accessed from a thread other than the thread it was created on.
Can anyone help me ?