Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing the selected Radio buttons of a form

Status
Not open for further replies.

Lladro

Programmer
Mar 5, 2007
18
US
Hello All!

I have a form which consists of questions and answers(radio buttons). I need to get all the radio buttons selected on the form upon pressing the Submit button.

This is my code for this and I seem to be getting this error:

Dim tmp As String = ""
Dim questID As String = ""
Dim ansID As String = ""

For i = 0 To Request.Form.Count
Select Case tmp = Request.Form.Get(i).ToString.Trim 'tmp
Case tmp.Substring(0, 5).ToString.Trim = "rdoTF"
rdotf = Split(Request.Form.GetValues(i).ToString.Trim, "~")
questID = rdotf(1)
ansID = rdotf(2)

Error: Index and length must refer to a location within the string. Parameter name: length

Can you tell me what I am doing wrong?

Thanks for your help!
 
Your select case doesn't make sense. This would be closer to the truth.

Code:
 For i = 0 To Request.Form.Count
    dim tmp as string = Request.Form.Get(i).ToString.Trim 
    if tmp.length > 5 then
       Select Case tmp.Substring(0, 5).ToString.Trim
          Case "rdoTF"
             rdotf Split(Request.Form.GetValues(i).ToString.Trim, "~")
             questID = rdotf(1)
             ansID = rdotf(2)
       end select 
     end if
 next



Christiaan Baes
Belgium

"My old site" - Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top