Hello everyone!
I've created a for loop to save a lab and it's variable to file and the number of students in that lab (initially set to 0) to a text file...like this
<% dim varStudNumb, varNumberNabs, varLineCounter, lab, tfrom, tto
lab = CInt(lab)
tfrom = CDbl(tfrom)
tto = CDbl(tto)
varStudNumb = CInt(varStudNumb)
varStudNumb = 0
'assign variable to hold number submitted
varNumberLabs = Request.Form("LabNumbs"
For varLineCounter = 1 to varNumberLabs
Response.Write "Lab:"
lab = Request.Form("Labs" & varLineCounter)
Response.Write lab
WriteToFile "Lab:"
WriteToFile Request.Form("Labs" & varLineCounter)
WriteToFile "Students:"
WriteToFile varStudNumb
WriteToFile vbCrLf
Response.Write "<br/>"
Next
CloseTextFile
%>
i can read the text from file also. like this:
<% 'more code above
'Read the file line by line
Do While Not TextStream.AtEndOfStream
line = textStream.readline
' Do something with "Line"
Response.Write Line %>
<input name="labSubmit" type="Submit" value="Submit"><br/>
<%loop
however, how can i extract a particular variable from file (for this, i need to extract the '0' of students, add 1 to it and then overwrite the 0 with the new number in the text file?). All this must be done when a particular submit button is pressed, according to the lab number chosen...by this i mean:
lab: 1 students: 0 [submit] <---button
lab: 2 studnets: 0 [submit]
when user presses submit button, 1 should be added to students and the new number of students should be saved to file
lab: 1 students: 1 [submit]
lab: 2 students: 0 [submit]
if anyone can help me, i'd really really appreciate it. thankyou! anticipating your reply!
I've created a for loop to save a lab and it's variable to file and the number of students in that lab (initially set to 0) to a text file...like this
<% dim varStudNumb, varNumberNabs, varLineCounter, lab, tfrom, tto
lab = CInt(lab)
tfrom = CDbl(tfrom)
tto = CDbl(tto)
varStudNumb = CInt(varStudNumb)
varStudNumb = 0
'assign variable to hold number submitted
varNumberLabs = Request.Form("LabNumbs"
For varLineCounter = 1 to varNumberLabs
Response.Write "Lab:"
lab = Request.Form("Labs" & varLineCounter)
Response.Write lab
WriteToFile "Lab:"
WriteToFile Request.Form("Labs" & varLineCounter)
WriteToFile "Students:"
WriteToFile varStudNumb
WriteToFile vbCrLf
Response.Write "<br/>"
Next
CloseTextFile
%>
i can read the text from file also. like this:
<% 'more code above
'Read the file line by line
Do While Not TextStream.AtEndOfStream
line = textStream.readline
' Do something with "Line"
Response.Write Line %>
<input name="labSubmit" type="Submit" value="Submit"><br/>
<%loop
however, how can i extract a particular variable from file (for this, i need to extract the '0' of students, add 1 to it and then overwrite the 0 with the new number in the text file?). All this must be done when a particular submit button is pressed, according to the lab number chosen...by this i mean:
lab: 1 students: 0 [submit] <---button
lab: 2 studnets: 0 [submit]
when user presses submit button, 1 should be added to students and the new number of students should be saved to file
lab: 1 students: 1 [submit]
lab: 2 students: 0 [submit]
if anyone can help me, i'd really really appreciate it. thankyou! anticipating your reply!