VB.Net Form take time to load.

I have form which is attached to menu it takes time 2 min to load,i want reduce this time.How can i do that? i am attached my code file frmdataentry.vb for reference.so pls give me some suggestion for reduce the time.
frmDataEntry.vb
Vijay Kamblesoftware engineerAsked:
Who is Participating?
 
BuggyCoderConnect With a Mentor Commented:
it looks as if you are doing too much in the form load event.
Just add backgroundworker in your form and let it process your on load tasks in background, this will enable your form to load immediately as it is called..

here is example of bgworker:-
http://www.dotnetperls.com/backgroundworker-vbnet

just one catch here, while the bgworker is processing, you will not be able to update any UI Control as bgworker uses ThreadPool thread to process in
background and you cannot access ui controls in another thread.

So keep that in mind...
0
 
CodeCruiserCommented:
One quick fix is to use the Shown event instead of Load event so your form appears immediately even though it may be not responding due to the work its doing.
0
 
Vijay Kamblesoftware engineerAuthor Commented:
I GOT MY SOLUATION THANKS DEAR....
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.