Results 1 to 6 of 6

Thread: problem with opening file

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    21

    problem with opening file

    ok i have it all in a subprocedure and it opens now thanks
    but i have to perform a calculation on dba and rest
    it s giving me a type mismatch error

    txtView.Text = txtView.Text + name + " " + sex + " " + dba + " " + rest + vbCrLf


    I dimmed it the same where it is called so Im a little lost
    Private Sub Spot(name As String, sex As String, dba As Integer, rest As Integer)

    txtView.Text = ""
    txtView.Enabled = True


    Open "a:\THRFILE.DAT" For Input As #1


    Do While Not EOF(1)
    Input #1, name
    Input #1, sex
    Input #1, dba
    Input #1, rest

    txtView.Text = txtView.Text + name + " " + sex + " " + dba + " " + rest + vbCrLf
    Loop

    Close #1

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    use & not + when manipulating strings

    VB Code:
    1. txtView.Text = txtView.Text & name & " " & sex & " " & dba & " " & rest & vbCrLf

    if u want to sum dba and rest and then add the result to the string:

    VB Code:
    1. txtView.Text = txtView.Text & name & " " & sex & " " & Str(dba + rest) & vbCrLf
    -= a peet post =-

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    21
    im not adding them together
    i need to use rest and dba to get a new value that will be also added to the file being opened

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    ok u lost me...

    u are not adding anything to the file in the code u posted above ... u are reading it...

    what?

    (remember I'm old and slow ... u have to explain it a bit better
    -= a peet post =-

  5. #5

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    21
    sorry
    im going to add a vew variable it uses

    picOutput.Visible = True
    picOutput.Cls
    x = (220 - dba - rest) * 0.6 + rest
    picOutput.Print name + "," + "your training heart rate is" + x


    im opening the file but it only has 4 items i neeed to open it with
    X as the last variable

    its not on the file im opening but it has to be added
    so when the file is opened x
    txtView.Text = txtView.Text & name & " " & sex & " " & dba & " " & rest &" "& x & vbCrLf

  6. #6

    Thread Starter
    Junior Member
    Join Date
    May 2002
    Posts
    21
    Private Sub Spot(name As String, sex As String, dba As Integer, rest As Integer, x As String)

    txtView.Text = ""
    txtView.Enabled = True

    x = (220 - dba - rest) * 0.6 + rest

    Open "a:\THRFILE.DAT" For Input As #1


    Do While Not EOF(1)
    Input #1, name
    Input #1, sex
    Input #1, dba
    Input #1, rest
    Input #1, x
    txtView.Text = txtView.Text & name & " " & sex & " " & dba & " " & rest & " " & x & vbCrLf
    Loop

    Close #1



    running past end of file due to the fact only 4 variables on a:\
    how do i get the x to post

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