Results 1 to 4 of 4

Thread: [RESOLVED] Pulling from a text document, yet no value?

  1. #1

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Resolved [RESOLVED] Pulling from a text document, yet no value?

    I am trying to pull 3 different values from a text document in the format of
    1 value per line.
    IE) 6
    19
    6/12/2005

    It pulls the first and last values out, but I seems to refuse to pull out the middle value.

    my code is as follows

    VB Code:
    1. Private Sub Form_Load()
    2. Dim DatesLength As Integer
    3. Open "H:\JOB\Dates.txt" For Input As #1
    4. PayIncreaseComboBox.Value = Input(2, #1)
    5. ShowLabels
    6. Dim ctl As Control
    7. For Each ctl In Me.Controls
    8. If ctl.Visible = True Then
    9.     If ctl.Name Like "DTPicker*" Then
    10.         DatesLength = Val(Input(2, #1))
    11.         MsgBox (DatesLength)
    12.         ctl.Value = Input(DatesLength, #1)
    13.     End If
    14. End If
    15. Next
    16. Close #1
    17. End Sub


    Anyone have any ideas?
    Last edited by kfcSmitty; May 19th, 2005 at 07:31 AM.

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Pulling from a text document, yet no value?

    Grab the whole file and split out by line:
    VB Code:
    1. Dim lines() as string
    2. Dim tmp as string
    3. Open "H:\JOB\Dates.txt" For Input As #1
    4. tmp = input(lof(1),1)
    5. Close #1
    6. lines = Split(tmp,vbcrlf)
    7. 'the following will be the values of lines()
    8. lines(0) = 6
    9. Lines(1) = 19
    10. lines(2) = 6/12/2005
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    Re: Pulling from a text document, yet no value?

    Thank you soooo much!

    The code you gave me even lets me omit some of the data i have in the text document!!

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: [RESOLVED] Pulling from a text document, yet no value?

    Glad to help
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width