Click here to Skip to main content
15,895,084 members

Comments by Partogame (Top 5 by date)

Partogame 6-Nov-16 9:48am View    
and my real situation:
private async void BtnTabEditCustomer_Click(object sender, EventArgs e)
{
uiPBLoading.Visible = true;
await InitTabEditCustomerAsync();
uiPBLoading.Visible = false;

}
Task InitTabEditCustomerAsync()
{
return Task.Factory.StartNew(
() =>
{
Fill_EditCustomerList();
});

void Fill_EditCustomerList()
{
List<customer> LCT = new List<customer> { };
LCT = CustomerBR.GetCustomerList();

DGV_ListEditCustomer.SuspendLayout();
_bw_Fill_EditCustomerList.DoWork += new DoWorkEventHandler(bw_Fill_EditCustomerList);
_bw_Fill_EditCustomerList.RunWorkerAsync(LCT);

}

}
BackgroundWorker _bw_Fill_EditCustomerList = new BackgroundWorker();
void bw_Fill_EditCustomerList(object sender, DoWorkEventArgs e)
{

DataTable table = UtilHandler.ToDataTable((List<customer>)e.Argument);



DGV_ListEditCustomer.Invoke(new EventHandler(delegate
{
DGV_ListEditCustomer.DataSource = table;
SetColumnsEditCustomerList();
DGV_ListEditCustomer.ResumeLayout();

}));

}
Partogame 6-Nov-16 9:44am View    
i did what you said for the example :
for (int i = 0; i < 10000; ++i)
{
if (richTextBox1.InvokeRequired)
{
richTextBox1.BeginInvoke((MethodInvoker)delegate { richTextBox1.Text = richTextBox1.Text + "s"; });
}
}
But again every thing is freezed.
Partogame 6-Nov-16 9:09am View    
that richtextbox was just an example.
this one " richTextBox1.Invoke(new EventHandler(delegate"
is exactly like "if (richTextBox1.InvokeRequired) {
richTextBox1.BeginInvoke((MethodInvoker) delegate { richTextBox1.Text = richTextBox1.Text + "s";"


"The less work you can do on the UI, the more responsive it will become."
this is write but my problem wasnt that richbox. i retrieve datatable from database with 6000 records and they should be bind to datagridview and this is taking much time
Partogame 6-Nov-16 8:34am View    
i know what you have said, imagine a situation like that richtextbox(i just want to say a work like this, ui work &...).
what can i do?
imagine i have to show all of them. is there any way to show a loading image for user?
thanks for your response
Partogame 6-Nov-16 8:16am View    
i have approximately about 6000 or 7000 records in my datatable.
is there any way to show them in just one page without freezing?
that string was just an example for showing freeze situation.