Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!




Well, I need help with my website. I created a program that counts the
number of players you have and the total cost to buy those players.
The number of players you bought should be added to the total. The
problem is, the number of players you bought won't add to the total
number of players. So, you buy it and the number is still equaled to


Sub Hire_Soldiers
Num = txtNumPeople.value
If Not IsNumeric(Num) Then
msgbox "You must enter a number in the box"
If Num = 0 Then
msgbox "You must enter a number larger than zero"
If Num > 112 Then
msgbox "You may only purchase 112 soldiers at a time."
If 7146750 < Num*10000 Then
msgbox "You do not have enough money to hire that many! Please
enter a smaller number."
msg = "Do you wish to spend $ " & FormatNumber(Num*10000,0)
msg = msg & " to hire " & FormatNumber(Num,0) & " new soldier"
If Num > 1 Then msg = msg & "s"
msg = msg & "?"
If msgbox(msg,vbYesNo,"Hire New Soldiers") = vbYes Then
document.url = "buy_people.asp?txtNum=" & Num &
"&CameFrom=market"End If
End if
End If
End If
End If

End Sub

You have 28 soldiers available. A platoon
requires 28
men. New recruits cost $10,000 each.

To hire 
 new soldiers click 
Recruit Soldiers


Yes, the first part is scripted as visual basic. The problem seems to
be with the line : document.url = "buy_people.asp?txtNum=" & Num &
Doesn't seem to go. Does any know how to by pass this and make it
added to the total number bought?


  • ZantosZantos Member Posts: 139
    Use this line of code instead of document.url
    Response.Redirect("buy_people.asp?txtNum=" & Num & "CameFrom=market")

    ..:: Zantos ::..

  • Shawn CarterShawn Carter Member Posts: 0

    _____ { } free video tutorials and ebooks about [ R, Scratch, Perl, Visual Basic .NET, C++, Swift, PHP, Go, Delphi, C#, Visual Basic, Ruby, Assembly, JavaScript, Java, C, Python, MATLAB, PL/SQL, Objective-C Kotlin, Prolog, SAS, Hack, Rust, Erlang, FoxPro, Crystal, Awk, LabVIEW, Scala, ML, Scheme, Dart, Julia, Clojure, Fortran, F#, Bash, Apex, Lua, Lisp, ABAP, Logo, Ada, D, VBScript, Alice, COBOL, Transact-SQL ] ___________

Sign In or Register to comment.