Results 1 to 3 of 3

Thread: Part of my previous problem "Input file"

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    9

    Part of my previous problem "Input file"

    Hi all,

    Private Sub Command1_Click()
    Open "filesp" For Output As #1
    v = 0
    For j = 1 To 10
    v = v + 3
    Write #1, v
    Picture1.Cls
    Picture1.Print v

    Next j
    Close #1
    End Sub

    from above code I wrote some data in file like 3, 6,9................30. To call or read that data sequentially under the same command button I wrote the following code. but I am able to call only the first value like 3. After some time I want to call the data like 6 by pressing the same command button. I didn't get.So I am expecting help to overcome this problem.

    Private Sub Command2_Click()
    Dim v As Integer
    Dim c As Integer
    Open "filesp" For Input As #1
    Input #1, v
    c = v
    Picture2.Cls
    Picture2.Print c
    'Next j
    Close #1
    End Sub

    Thanks a lot for your answer
    Bye

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Part of my previous problem "Input file"

    try like this
    VB Code:
    1. Dim v As Integer
    2. Dim c As Integer
    3. Open "filesp" For Input As #1
    4. Do While Not EOF(1)
    5.     Input #1, v
    6.     c = v
    7.     Picture2.Cls
    8.     Picture2.Print c
    9. Loop
    10. Close #1
    Last edited by westconn1; Aug 15th, 2006 at 05:11 AM.
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3
    Lively Member
    Join Date
    Aug 2006
    Posts
    69

    Re: Part of my previous problem "Input file"

    but maybe you have to delete "Picture2.Cls" command to display all read data

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