473,320 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Where to do the Loading tasks for application ?

Hi all,

I have an Windows application in which the startup form is called
"MainForm". Now when this form loads, I need to do some intensive tasks
like loading and parsing an XML file, that takes about 10-12 secs.

Initially I was doing it through Multi-threading, by calling the
intensive function (refer to as "LongTask()"), in a separate thread, in
the Load Event of the form. But the pitfall was that the user could
click the MenuItem that requires that function to have completed...

I have since added a "Loading" form with a progressbar as the startup
form, so that MainForm is shown only after all the Loading is done.

Now I am confused about where to add the task intensive function?
Should I transfer all it's code to the "Loading" form ? Or should I
make it a Public function in MainForm and call it from the "Loading"
form ? Or should I use a Shared Sub Main ?

An added complication is that I have to keep track of the progress of
the "LongTask" to show it in a progress bar.

I hope I am able to communicate the problem effectively.

Regards,

Cerebrus.

Apr 3 '06 #1
5 1128
Anyone ??

Apr 4 '06 #2
uh do it on the FORM_LOAD event lol

wish i coudl be more help

ps - wtf are you doing to ANY xml file that takes 10-12 seconds? why
don't you just find a faster way to do that

Apr 5 '06 #3
Hi,
wish i coudl be more help
No problem, I solved the issue.
wtf are you doing to ANY xml file that takes 10-12 seconds? why
don't you just find a faster way to do that


Well, how about :
1. Loading a 2 MB Xml File, that contains Books and Authors etc, into
an XPathDocument.
2. Selecting all distinct Authors, using an XPath expression.
3. Sorting this list.
4. For each author, traversing the entire Xml file, counting the no. of
books by this Author.
5. Adding this information to an ArrayList.

Can you think of a better way to do this ?

Regards,

Cerebrus.

Apr 6 '06 #4
On 5 Apr 2006 18:19:29 -0700, "Cerebrus" <zo*****@sify.com> wrote:
Hi,
wish i coudl be more help
No problem, I solved the issue.
wtf are you doing to ANY xml file that takes 10-12 seconds? why
don't you just find a faster way to do that


Well, how about :
1. Loading a 2 MB Xml File, that contains Books and Authors etc, into
an XPathDocument.
2. Selecting all distinct Authors, using an XPath expression.
3. Sorting this list.
4. For each author, traversing the entire Xml file, counting the no. of
books by this Author.
5. Adding this information to an ArrayList.

Can you think of a better way to do this ?

Regards,

Cerebrus.


Is the Xml File local?

I had a similar situation using a local xml file. I converted it to
an access db which is about 1/2 the xml file size. The preformance
with the db is 10 times faster than was with the xml file.

Gene
Apr 6 '06 #5
Hi Gene,

Thanks for your response.

Yes, the XML file is local. I know this could be done much faster using
a database, but the requirement in this case was to do it with an XML
file.

Oh well...

I think I have optimized it as much as possible, and the whole process
is now completed in 9 seconds. This is on my 433 MHz home PC, so I
think it might be good to go !

BTW, I found that I could gain 2.5 seconds by doing my stuff in the Sub
New() of the form, rather than the Form_Load event. I don't know what
the logic behind this could be, though.

Regards,

Cerebrus.

Apr 6 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Codemonkey | last post by:
Hi, I am writing an App in .Net that involves some scheduling of tasks. I was wondering if anybody has come accross any components or examples of how to implement a schedule manager like the one...
13
by: BK | last post by:
Can someone point me to a code sample that illustrates executing long running tasks (asynchronous) from a web application in ASP.NET? I assume that Web Services might come into play at some point,...
9
by: Ender | last post by:
I have an application that I would like third party developers to be able to create Plug-ins that will be dynamically loaded into our application to extend functionality. I have utilized the...
6
by: Andrea Williams | last post by:
Where is the best place to put global variables. In traditional ASP I used to put all of them into an include file and include it in every page. Will the Global.aspx.cs do that same thing? ...
3
by: Peter Strøiman | last post by:
Hi. I have a web application that needs to run tasks at regular intervals. E.g. it must send out emails every night to people who subscribe to that service. I have come up with one solution,...
0
by: Matthieu Siggen | last post by:
Hello, I'm really confused about how to define services when concerning data management. I'm going to take an example to show where is my problem. If I'm developping an application with two...
0
by: John Samson | last post by:
I am building a windows services scheduler that shall fetch file and import the data into a SQL Server according to the predefined schedule. My idea is to create two application 1) App 1 -...
5
by: rdemyan via AccessMonster.com | last post by:
I would like to have my application add administrative tasks to an Administrator's Outlook Task Folder. I know how to get the User group of the CurrentUser and think I can even code how to do the...
2
by: anuanusha29 | last post by:
Hi, I have pasted the xml file below. When I try to load this xmlfile into an instance of xml document, it gives "Root element missing ". I tried to check the well formedness and xpath queries in...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.