Asp & Vb....
#1
Posted 16 March 2005 - 10:03 PM
Im still new to ASP...so SENIORS pls correct me if my following code has something wrong...thank you guys.....:
filename : ASP_VB.asp
--------------------------------------------------------------------------
<html>
<head>
<title>ASP_VB </title>
</head>
<body>
<form action="ASP_VB.asp" method="post">
<br>
<input type="text" name="mytext">
<input type="submit" value="display">
</form>
<br>
<br>
<%
Dim keep_track()
Dim i
Dim value_get
For i = 1 to 3
keep_track(i) = Request.Form("mytext")
Next
%>
<%
<script>
Function max(keep_track(i))
If keep_track(i) > (keep_track(i+1)&keep_track(i+2))then
Response.write(keep_track(i))
elseif keep_track(i+1) > (keep_track(i)&keep_track(i+2))then
Response.write(keep_track(i+1))
else
Response.write(keep_track(i+2))
End if
End Function
</script>
%>
</body>
</html>
-------------------------------------------------------------------------
#2
Posted 17 March 2005 - 04:19 PM
#3
Posted 18 March 2005 - 01:59 AM
#4
Posted 18 March 2005 - 11:54 AM
i know the error already....dont need to reply me anymore...
i need more html input text box to enter more value, such as 4 text box to enter 4 value.....and then click "Compare" button...after that, it will show the highest value in output in the same page......
thanks again....i solved my problem already...
here is my coding:
--------------------------------------------------------------------
<html>
<head>
<title>Comparing Arrays</title>
</head>
<body>
<form name="input" method="post" action="array.asp">
Enter input 1<input type="textbox" name="input1">
<br>
Enter input 2<input type="textbox" name="input2">
<br>
Enter input 3<input type="textbox" name="input3">
<br>
Enter input 4<input type="textbox" name="input4">
<br>
<input type="submit" value="Find Max Number">
</form>
<%
Dim myArray(3)
myArray(0) = Request.Form("input1")
myArray(1) = Request.Form("input2")
myArray(2) = Request.Form("input3")
myArray(3) = Request.Form("input4")
Call max(myArray(0), myArray(1), myArray(2), myArray(3))
%>
<br><br>
<%
Public Function max(ByVal a, ByVal b, ByVal c, ByVal d)
If a > b Then
If a > c Then
If a > d Then
Response.write(a)
Else
Response.write(d)
End If
Else
If c > d Then
Response.write©
Else
Response.write(d)
End If
End If
Else
If b > c Then
If b > d Then
Response.write(
Else
Response.write(d)
End If
Else
If c > d Then
Response.write©
Else
Response.write(d)
End If
End If
End If
End Function
%>
</body>
</html>
------------------------------------------------------------------------------------
thanks again
do you guys have anything add into the coding above?
like...how to prevent String input if we key in characters or string value, etc....
#5
Posted 19 March 2005 - 01:15 AM
String builder has a LOT of really nice features, and you might want to take a look at some examples or I could paste some for your situation if need be.halo guys, thanks for getting your response.
i know the error already....dont need to reply me anymore...
i need more html input text box to enter more value, such as 4 text box to enter 4 value.....and then click "Compare" button...after that, it will show the highest value in output in the same page......
thanks again....i solved my problem already...![]()
here is my coding:
--------------------------------------------------------------------
<html>
<head>
<title>Comparing Arrays</title>
</head>
<body>
<form name="input" method="post" action="array.asp">
Enter input 1<input type="textbox" name="input1">
<br>
Enter input 2<input type="textbox" name="input2">
<br>
Enter input 3<input type="textbox" name="input3">
<br>
Enter input 4<input type="textbox" name="input4">
<br>
<input type="submit" value="Find Max Number">
</form>
<%
Dim myArray(3)
myArray(0) = Request.Form("input1")
myArray(1) = Request.Form("input2")
myArray(2) = Request.Form("input3")
myArray(3) = Request.Form("input4")
Call max(myArray(0), myArray(1), myArray(2), myArray(3))
%>
<br><br>
<%
Public Function max(ByVal a, ByVal b, ByVal c, ByVal d)
If a > b Then
If a > c Then
If a > d Then
Response.write(a)
Else
Response.write(d)
End If
Else
If c > d Then
Response.write©
Else
Response.write(d)
End If
End If
Else
If b > c Then
If b > d Then
Response.write(![]()
Else
Response.write(d)
End If
Else
If c > d Then
Response.write©
Else
Response.write(d)
End If
End If
End If
End Function
%>
</body>
</html>
------------------------------------------------------------------------------------
thanks again![]()
do you guys have anything add into the coding above?
like...how to prevent String input if we key in characters or string value, etc....
Another item you might want to consider are validation or custom validation controls. Depending on the user environment you can use regular expressions to clean up textbox info based upon business rules, etc., or you may consider using various events etc to not allow certain key input...
Those are just a couple of ideas, the smaller you make the code the easier it is to trace and debug. If possible I would go right to string builder and get away from the arrays you are using, I am not slamming anyone because I don't know the situation for it but, readability, flow, and performance can be resolved by using string builder and regular expressions.
#6
Posted 20 March 2005 - 06:00 AM
really appreciated your comment....
the coding is required by my assignment questions, the question need me to use array, so i just follow the instruction to get my marks.....
i'm very new to VB and ASP....still learning and is going to have test.....now i'm doing the JAVA assignments... need to create a MyPet program....
Thanks for your reply...
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












