|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Writing to a text file - for loop problem - syntax error
I am trying to write to a text file in asp. I have created the following bit of code but it keeps coming up with a syntax error. I'm new to asp so it might be a really simple problem!
Code:
dim myFile, i
myFile.WriteLine (For i = 1 to 3 Request.Form("inst_time" &i).Item) Next)
I know it doesn't like the for loop in there but I dont know what it should be formatted like? Can anyone help? |
|
#2
|
||||
|
||||
|
Try
Code:
For i = 1 to 3
myFile.WriteLine Request.Form("inst_time") &i
Next
BTW, what was the syntax error? |
|
#3
|
|||
|
|||
|
That doesn't work. It merely prints 1,2,3 on different lines. I think I need the i within the reponse.form as the values of the select boxes I am trying to capture are called inst_time1, inst_time2 etc. The idea is there as if I use your code with one modification :-
Code:
For i = 1 to 3
myFile.WriteLine Request.Form("inst_time" &i)
Next
It prints the value of the select boxes but on new lines. I am after printing the values of the select boxes all on one line and the append the values of some of text field on the same line, can this be done? BTW it didnt say much, it just said syntax error on the original line of code I gave. |
|
#4
|
||||
|
||||
|
Didn't realize the text box names had the numbers in them, I thought you were just trying to number your entries. Anyway, try changing "myFile.WriteLine" to "myFile.Write". Does the same thing, but no line break.
HTH
__________________
--Dave-- U2kgSG9jIExlZ2VyZSBTY2lzLCBOaW1pdW0gRXJ1ZGl0aW9uaXMgSGFiZXM= |
|
#5
|
|||
|
|||
|
Sorry guess I didn't explain things very well.
But excellent! A simple change from writeline to write works wonders!! Many thanks karsh44!!! |
|
#6
|
||||
|
||||
|
Glad to help
![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ASP Programming > Writing to a text file - for loop problem - syntax error |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|