Logic Troubles - reading in a difficult textfile


J

Justin Fancy

Hi everyone,

I have a textfile which I need to read and compare dates. The text file
summarizes every time I do an update to an internet site. Sample output
is as follows:



Copying humanresources\compensation files from tcinfotest to tcinfo
-----------------------
Start Time:
Tue 01/03/2006
7:26a
-----------------------
D:\tcinforoot\humanresources\compensation\employee\pay\hrkit.htm ->
F:\humanresources\compensation\employee\pay\hrkit.htm
D:\tcinforoot\humanresources\compensation\employee\pay\incometax.htm ->
F:\humanresources\compensation\employee\pay\incometax.htm
D:\tcinforoot\humanresources\compensation\forms\alberta06.pdf ->
F:\humanresources\compensation\forms\alberta06.pdf
6 File(s) copied
-----------------------
End Time:
Tue 01/03/2006
7:26a
-----------------------
Copying ressourceshumaines\remuneration files from tcinfotest to tcinfo

-----------------------
Start Time:
Tue 01/03/2006
7:27a
-----------------------
D:\tcinforoot\ressourceshumaines\remuneration\employe\paie\taxes.htm ->
F:\ressourceshumaines\remuneration\employe\paie\taxes.htm

2 File(s) copied
-----------------------
End Time:
Tue 01/03/2006
7:27a
-----------------------



I am creating a form with two DateTimePickers for the user to select
the date periods in which he/she wants to report on. I'm having trouble
with the logic of the loops.

So the two dates are read in using "Date1.Text" and "Date2.Text" (User
inputs). I have a customformat on the datetimepicker so that it is the
same as the output in the textfile. SO now, I am trying to compare the
dates.

If the beginning date is in the textfile, I want to display every line
until the last entry of the end date. So then i'll have the right time
right period. When I get the information, I plan to format it, but I
know how to do that, i'm just stuck on the logic.

If someone could help it would be awesome. Thanks.


Justin Fancy
 
Ad

Advertisements

R

Ryan S. Thiele

Try this:
-------------

Public Sub GetDataFromDates(StartDate as date, EndDate as date)
'Opening and reading file method
'.
'.
'We will assume you place the date read from the file in D1 variable...

While SR.Peak <> -1
if D1 <= EndDate And D1 => StartDate
'Do work. Print the date and data...
elseif D1 > EndDate
'The date is past the end date.
'Close the StreamReader
SR.Close
'Exit the Sub
Exit Sub
End If
End Sub
------------
The problem is what if you have a date the is after the end date? Hope this
helps.


--
--
Thiele Enterprises - The Power Is In Your Hands Now!
--
Hi everyone,

I have a textfile which I need to read and compare dates. The text file
summarizes every time I do an update to an internet site. Sample output
is as follows:



Copying humanresources\compensation files from tcinfotest to tcinfo
-----------------------
Start Time:
Tue 01/03/2006
7:26a
-----------------------
D:\tcinforoot\humanresources\compensation\employee\pay\hrkit.htm ->
F:\humanresources\compensation\employee\pay\hrkit.htm
D:\tcinforoot\humanresources\compensation\employee\pay\incometax.htm ->
F:\humanresources\compensation\employee\pay\incometax.htm
D:\tcinforoot\humanresources\compensation\forms\alberta06.pdf ->
F:\humanresources\compensation\forms\alberta06.pdf
6 File(s) copied
-----------------------
End Time:
Tue 01/03/2006
7:26a
-----------------------
Copying ressourceshumaines\remuneration files from tcinfotest to tcinfo

-----------------------
Start Time:
Tue 01/03/2006
7:27a
-----------------------
D:\tcinforoot\ressourceshumaines\remuneration\employe\paie\taxes.htm ->
F:\ressourceshumaines\remuneration\employe\paie\taxes.htm

2 File(s) copied
-----------------------
End Time:
Tue 01/03/2006
7:27a
-----------------------



I am creating a form with two DateTimePickers for the user to select
the date periods in which he/she wants to report on. I'm having trouble
with the logic of the loops.

So the two dates are read in using "Date1.Text" and "Date2.Text" (User
inputs). I have a customformat on the datetimepicker so that it is the
same as the output in the textfile. SO now, I am trying to compare the
dates.

If the beginning date is in the textfile, I want to display every line
until the last entry of the end date. So then i'll have the right time
right period. When I get the information, I plan to format it, but I
know how to do that, i'm just stuck on the logic.

If someone could help it would be awesome. Thanks.


Justin Fancy
 

Top