S
shibeta
Hello,
I have problem with DataGridView and BindingSource. I have created
DataSet and added TableData to it with manualy created columns
(without DataAdapter - I'm not using MSSQL). On the Form I put
DataGridView and BindingSource, and connected them (BindingSource of
course is also connected with DataSet). Next on the separated thread
I'm reading data from DB and load them do DataSet (more preciselly,
readed data I've saved as XML and them this XML load to DataSet).
Everything looks OK - DataSet is filled with rows But nothing
appears on the DataGridView, so on the end of thread I've executed
"refreshBS()" method (like below - threadsafe) and the datgridview
fills with rows, too.
public void refreshBS()
{
if (this.InvokeRequired)
{
RefreshUserDetails rud = new
RefreshUserDetails(this.refreshBS);
this.Invoke(rud);
}
else
{
this.DataSet1.AcceptChanges();
this.BindingSource.CurrencyManager.Refresh();
}
}
I thought that everything is OK until I've lunch my application
from .EXE file :-( I have discovered that when I lunch it from .EXE
file it hangs on the line give above
"this.BindingSource.CurrencyManager.Refresh()" (when I lunch this from
Visual Studio (F5) everything works fine).
My question is : is there any other way to refresh DataGridView with
data from BindingSource ?
Also i have tested the method :
CurrencyManager cm = this.Datagridview.bindingcontext.....
cm.refresh()
and the result is the same :-(
Now to refresh data on DataGridView with BindingSource I'm sorting
DataGridView programatically and it helps but I think that it's not
the way it should be done.
Thanks.
I have problem with DataGridView and BindingSource. I have created
DataSet and added TableData to it with manualy created columns
(without DataAdapter - I'm not using MSSQL). On the Form I put
DataGridView and BindingSource, and connected them (BindingSource of
course is also connected with DataSet). Next on the separated thread
I'm reading data from DB and load them do DataSet (more preciselly,
readed data I've saved as XML and them this XML load to DataSet).
Everything looks OK - DataSet is filled with rows But nothing
appears on the DataGridView, so on the end of thread I've executed
"refreshBS()" method (like below - threadsafe) and the datgridview
fills with rows, too.
public void refreshBS()
{
if (this.InvokeRequired)
{
RefreshUserDetails rud = new
RefreshUserDetails(this.refreshBS);
this.Invoke(rud);
}
else
{
this.DataSet1.AcceptChanges();
this.BindingSource.CurrencyManager.Refresh();
}
}
I thought that everything is OK until I've lunch my application
from .EXE file :-( I have discovered that when I lunch it from .EXE
file it hangs on the line give above
"this.BindingSource.CurrencyManager.Refresh()" (when I lunch this from
Visual Studio (F5) everything works fine).
My question is : is there any other way to refresh DataGridView with
data from BindingSource ?
Also i have tested the method :
CurrencyManager cm = this.Datagridview.bindingcontext.....
cm.refresh()
and the result is the same :-(
Now to refresh data on DataGridView with BindingSource I'm sorting
DataGridView programatically and it helps but I think that it's not
the way it should be done.
Thanks.