B
bilosta
I have one MainFORM form (it hase dataGridView and button).
one class called DoEverithing (works with data base)
Form PleaseWait (with progress bar)
Here is my problem:
When I click button in Main form i want to populate datagridview with
some data from database.
here is a call:
in MainFORM:
-----------------------------------------------------------------------------------
DoEverithing myDo = new DoEverithing();
private void Button1_Click(object sender, EventArgs e)
{
//call the Please wait form
PleaseWait myPlease = new PleaseWait(this);
myPlease.ShowDialog();
}
public void Populate()
{
dataGridView1.DataSource = myDo.Populate();//it returns dataTable
}
----------------------------------------------------------------------------------
in PleseWait form
----------------------------------------------------------------------------------
public partial class PleaseWait : Form
{
MainFORM myMain;
public MolimSacekajte(MainFORM myMain)
{
this.myMain = myMain;
InitializeComponent();
backgroundWorker1.RunWorkerAsync();
}
private void DOWork(object sender, DoWorkEventArgs e)
{
myMain.Populate();
}
private void zavrsi(object sender, RunWorkerCompletedEventArgs
e)
{
this.Close();
}
----------------------------------------------------------------------------------
I get an error "Cross-thread operation not valid" for dataGridView1
control, how can i repair this. Please help
or tell me another way how to show please wait while dataGridView
populete
Thanx in advance OGA
one class called DoEverithing (works with data base)
Form PleaseWait (with progress bar)
Here is my problem:
When I click button in Main form i want to populate datagridview with
some data from database.
here is a call:
in MainFORM:
-----------------------------------------------------------------------------------
DoEverithing myDo = new DoEverithing();
private void Button1_Click(object sender, EventArgs e)
{
//call the Please wait form
PleaseWait myPlease = new PleaseWait(this);
myPlease.ShowDialog();
}
public void Populate()
{
dataGridView1.DataSource = myDo.Populate();//it returns dataTable
}
----------------------------------------------------------------------------------
in PleseWait form
----------------------------------------------------------------------------------
public partial class PleaseWait : Form
{
MainFORM myMain;
public MolimSacekajte(MainFORM myMain)
{
this.myMain = myMain;
InitializeComponent();
backgroundWorker1.RunWorkerAsync();
}
private void DOWork(object sender, DoWorkEventArgs e)
{
myMain.Populate();
}
private void zavrsi(object sender, RunWorkerCompletedEventArgs
e)
{
this.Close();
}
----------------------------------------------------------------------------------
I get an error "Cross-thread operation not valid" for dataGridView1
control, how can i repair this. Please help
or tell me another way how to show please wait while dataGridView
populete
Thanx in advance OGA