15,895,084 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
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.