K
Keith (Southend)G
No problem, I like doing stuff like this.
On the long delay for loading the file, I had a similar experience today
when testing the program, but only the first time I read the file. Every
time I tried to read it after that, it read it very quickly. Since I
couldn't duplicate it, I wasn't able to track it down. It's possible that
the program is loading a library into memory, or the O/S is building a list
of all the files in the folder, or something. I'm pretty sure the delay is
happening outside the program, but I'm not sure where. If it is happening
outside the program, your form probably won't respond until eith .NET or the
O/S is done doing whatever it needs to do. My guess is that you'll see a bit
of a wait, then all of a sudden you'll see the text box filling with data,
fairly quickly. If your experience is like mine, if you close the program
and start it up again, it will read the file almost immediately the second
time.
I went ahead and changed the program so that the data class raises an event
every time it finishes reading a line of text, and also right before it
creates an output file. To do that, I had to move the code that does the
actual reading of the data from the New sub into a separate one, and callit
separately. The events weren't being processed inside the constructor for
the class. I changed the form so that it intercepts the events and populates
the text boxes from them, rather than looping through the results later. In
the event handlers, I called a method named DoEvents, which makes sure that
the textbox updates are visible immediately, and lets the rest of the form
respond to movement, if needed. I also added to the program to have it
disable the buttons and change the cursor to the "Wait" mode (usually an
hourglass) while it's reading; that way, you know it's working, and you know
when it's done. The updated code is here:
http://www.CaptainJack3s.com/Code/ogprog4.txt
As for grabbing the data off the web, that may take a bit. I've done thata
few times before, using the WebBrowser control. I'm not certain what we need
to do, and it may take some playing with. I'll take a look at it, but it's
the kind of thing I probably won't get to until the weekend, and it may take
a couple of weekends of playing with it to get it right. The WebBrowser
control raises events every time it gets a web page, and if the page is
sending multiple bits (which will happen a lot with ASP pages and sometimes
with PHP) there can be a lot of event occurences to sift through before you
get the data you want. I'm working on an animation right now (one of my
other hobbies) which will fill up my nights this week, but I should have
some time either Saturday or Sunday (whichever day my team isn't playing....
go Colts and all that <G>). I'll try to create a component that goes to the
web site and grabs some data, then we can look at how to track date ranges,
countries read, and so on.
http://www.captainjack3d.com/Code/ogprog4.txt
Ah, found it