|
-
Jun 15th, 2013, 04:46 AM
#31
Thread Starter
Member
Re: Multiple viewing of Matching Data frp, a Textfile.
Sorry doogle, i think i messed up what i was trying to do.
Code:
Private Sub Form_Load()
Dim intfile As Integer
Dim savefile As Long
Dim sOut As String
Dim username As String, score As String, outoff As String, difficulty As String, starsearned As String, type1 As String, gametype As String
Dim fullname As String, username1 As String, pass As String, admin As String, Currentstars As String
Dim usercheck As String
Dim pickdiff As String
Dim picktype As String
Dim intfile2 As Integer
Dim newstars As String
Dim intfile3 As Integer
Dim newgametype As String
If frmquickgame.opteasy = True Then
pickdiff = "Easy"
ElseIf frmquickgame.optmedium = True Then
pickdiff = "Medium"
ElseIf frmquickgame.optmedium = True Then
pickdiff = "Hard"
End If
If frmquickgame.optaddition = True Then
picktype = "Addition"
ElseIf frmquickgame.optminus = True Then
picktype = "Subtraction"
ElseIf frmquickgame.opttimes = True Then
picktype = "Multiplication"
ElseIf frmquickgame.optdivide = True Then
picktype = "Division"
ElseIf frmquickgame.optall = True Then
picktype = "A Mixture"
End If
If qgame = True Then
newgametype = "Quick Game"
End If
intfile = FreeFile()
Open "Q:\IPT\project\vb prject2013\scores.txt" For Input As #intfile
Input #intfile, username, score, outoff, difficulty, starsearned, type1, gametype
sOut = QuoteString(username) & "," & QuoteString(frmtest.lblright.Caption) & "," & QuoteString(frmtest.lblinvisible.Caption) & "," & QuoteString(pickdiff) & "," & QuoteString(frmtest.lblstarscount.Caption) & "," & QuoteString(picktype) & "," & QuoteString(gametype)
Close intfile
savefile = FreeFile()
Open "Q:\IPT\project\vb prject2013\scores.txt" For Append As #savefile
Print #savefile, sOut
Close #savefile
intfile2 = FreeFile()
Open "Q:\IPT\project\vb prject2013\names.txt" For Input As intfile2
intfile3 = FreeFile()
Open "Q:\IPT\project\vb prject2013\names_temp.txt" For Output As intfile3
Do Until EOF(intfile2)
Input #intfile2, fullname, username1, pass, admin, Currentstars
If frmmain.lblname.Caption = username1 Then
newstars = Currentstars + Val(frmtest.lblstarscount.Caption)
Write #intfile3, fullname; username1; pass; admin; newstars
Else
Write #intfile3, fullname; username1; pass; admin; Currentstars
End If
Loop
Close #intfile2
Close #intfile3
Kill "Q:\IPT\project\vb prject2013\names.txt"
Name "Q:\IPT\project\vb prject2013\names_temp.txt" As "Q:\IPT\project\vb prject2013\names.txt"
End Sub
The addition of the stars to the names.txt is working fine however the scores.txt is adding a extra line of half information like so:
"user1","2","10","Easy","4","Multiplication","Quick Game"
"user2","8","10","Easy","8","Multiplication","Quick Game"
"user3","5","10","Easy","6","Addition","Quick Game"
"user2","6","12","Medium","5","Division","Quick Game"
"user1","0","0","","0","Addition","Quick Game"
"user1","3","12","","6","Addition","Quick Game"
When i want it to be:
"user1","2","10","Easy","4","Multiplication","Quick Game"
"user2","8","10","Easy","8","Multiplication","Quick Game"
"user3","5","10","Easy","6","Addition","Quick Game"
"user2","6","12","Medium","5","Division","Quick Game"
"user1","3","12","","6","Addition","Quick Game"
The the reason why i'm not using write statment because it was still not formatting the way i wanted it to. (i did try it on another computer and it worked-but the computer i'm on now is the predominate computer for use)
Could the print statement be causeing this extra line or possible the function. I did have a think that it may have something to do with the form loading when the this data hasnt been gathered since this whole thing is on the form load event.
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
|