|
-
May 12th, 2002, 12:09 PM
#1
Thread Starter
Junior Member
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
-
May 12th, 2002, 12:14 PM
#2
-= B u g S l a y e r =-
use & not + when manipulating strings
VB Code:
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:
txtView.Text = txtView.Text & name & " " & sex & " " & Str(dba + rest) & vbCrLf
-
May 12th, 2002, 12:20 PM
#3
Thread Starter
Junior Member
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
-
May 12th, 2002, 12:24 PM
#4
-= B u g S l a y e r =-
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
-
May 12th, 2002, 12:36 PM
#5
Thread Starter
Junior Member
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
-
May 12th, 2002, 12:58 PM
#6
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|