ASP+VBScript

Asked By JAYA PRAKASH
09-Feb-10 12:17 AM
Earn up to 0 extra points for answering this tough question.
end of post

  re: ASP+VBScript

Ryan C. replied to JAYA PRAKASH
09-Feb-10 02:09 AM
What would you like to know about classic asp?

  re: re: ASP+VBScript

JAYA PRAKASH replied to Ryan C.
09-Feb-10 10:20 AM
I want a ASP+VBScript program to read array elements(not assigning values to array)?
Please send me the program and help me

  re: re: re: ASP+VBScript

Ryan C. replied to JAYA PRAKASH
09-Feb-10 10:24 AM
View the code below, the critical part to retrieve values from an array is the for loop.

<%
Dim myArray(3) 'Fixed size array
myArray(0) = "Ferrari"
myArray(1) = "Porsche"
myArray(2) = "BMW"
myArray(3) = "Honda"
myArray(4) = "Subaru"

For Each item In myFixedArray
Response.Write(item & "<br />")
Next
%>


Output would be:
Ferrari
Porsche
BMW
Honda 
Subaru
  re: re: re: re: ASP+VBScript
JAYA PRAKASH replied to Ryan C.
10-Feb-10 01:52 AM
Dear Ryan C.
I know how to assign the values to array. But i want to read the array elements as we do in c program. Iam trying to use inputbox to read a element and then assign to the array. Here is the code.
The value of x iam reading through inputbox is taken as zero not as a value
please check the program for any error. let me know

<%@LANGUAGE="VBSCRIPT" %>
<%option explicit%>
<%dim a(10),n,i,x,y%>
<html>

<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%for  i = 0 to 4 %>
<script language="VBScript">
x=InputBox ("Enter the array elements" )
</script>
<%y=Cint(x)%>
<%a(i)=y%>
<%Response.write("Array" & a(i))%>
<%next%>
</head>
<body>
<form name="f1">
</form>
</body>
</html>

  re: re: re: re: ASP+VBScript
JAYA PRAKASH replied to Ryan C.
10-Feb-10 01:52 AM
Dear Ryan C.
I know how to assign the values to array. But i want to read the array elements as we do in c program. Iam trying to use inputbox to read a element and then assign to the array. Here is the code.
The value of x iam reading through inputbox is taken as zero not as a value
please check the program for any error. let me know

<%@LANGUAGE="VBSCRIPT" %>
<%option explicit%>
<%dim a(10),n,i,x,y%>
<html>

<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<%for  i = 0 to 4 %>
<script language="VBScript">
x=InputBox ("Enter the array elements" )
</script>
<%y=Cint(x)%>
<%a(i)=y%>
<%Response.write("Array" & a(i))%>
<%next%>
</head>
<body>
<form name="f1">
</form>
</body>
</html>

Create New Account