Logic Troubles - reading in a difficult textfile

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Justin Fancy

    #1

    Logic Troubles - reading in a difficult textfile

    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\h umanresources\c ompensation\emp loyee\pay\hrkit .htm ->
    F:\humanresourc es\compensation \employee\pay\h rkit.htm
    D:\tcinforoot\h umanresources\c ompensation\emp loyee\pay\incom etax.htm ->
    F:\humanresourc es\compensation \employee\pay\i ncometax.htm
    D:\tcinforoot\h umanresources\c ompensation\for ms\alberta06.pd f ->
    F:\humanresourc es\compensation \forms\alberta0 6.pdf
    6 File(s) copied
    -----------------------
    End Time:
    Tue 01/03/2006
    7:26a
    -----------------------
    Copying ressourceshumai nes\remuneratio n files from tcinfotest to tcinfo

    -----------------------
    Start Time:
    Tue 01/03/2006
    7:27a
    -----------------------
    D:\tcinforoot\r essourceshumain es\remuneration \employe\paie\t axes.htm ->
    F:\ressourceshu maines\remunera tion\employe\pa ie\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

  • Ryan S. Thiele

    #2
    Re: Logic Troubles - reading in a difficult textfile

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

    Public Sub GetDataFromDate s(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!
    --
    "Justin Fancy" <justinfancy@gm ail.comwrote in message
    news:1164807949 .610286.91200@j 72g2000cwa.goog legroups.com...
    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\h umanresources\c ompensation\emp loyee\pay\hrkit .htm ->
    F:\humanresourc es\compensation \employee\pay\h rkit.htm
    D:\tcinforoot\h umanresources\c ompensation\emp loyee\pay\incom etax.htm ->
    F:\humanresourc es\compensation \employee\pay\i ncometax.htm
    D:\tcinforoot\h umanresources\c ompensation\for ms\alberta06.pd f ->
    F:\humanresourc es\compensation \forms\alberta0 6.pdf
    6 File(s) copied
    -----------------------
    End Time:
    Tue 01/03/2006
    7:26a
    -----------------------
    Copying ressourceshumai nes\remuneratio n files from tcinfotest to tcinfo

    -----------------------
    Start Time:
    Tue 01/03/2006
    7:27a
    -----------------------
    D:\tcinforoot\r essourceshumain es\remuneration \employe\paie\t axes.htm ->
    F:\ressourceshu maines\remunera tion\employe\pa ie\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


    Comment

    Working...