Results 1 to 12 of 12

Thread: Looking for an easier way to nestle multiple If statements

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2013
    Posts
    123

    Looking for an easier way to nestle multiple If statements

    Here is my the relevant section of my code:

    Code:
     If NineInEight = "1" Then
                        If PickIt = "1" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickOne)
                        If PickIt = "2" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickTwo)
                        If PickIt = "3" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickThree)
                        If PickIt = "4" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickFour)
                        If PickIt = "5" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickFive)
                        If PickIt = "6" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickSix)
                        If PickIt = "7" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickSeven)
                        If PickIt = "8" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickEight)
                        If PickIt = "9" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickNine)
                        If PickIt = "10" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickTen)
                        If PickIt = "11" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickEleven)
                        If PickIt = "12" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickTwelve)
                        If PickIt = "13" Then WebWindow.WebBrowser1.Document.GetElementById("promptInput_41188").SetAttribute("value", PickThirteen)
    
                    ElseIf NineInEight = "2" Then
    
                    End If
    Basically I just want to shorten it. I'm pretty sure I can use: For i = 1 to 13 / Next and set the If Pickit = i Then.... ("value", Pick......) <- but this is where I'm stumped. Not sure how to proceed to make this simpler on myself using the value "Pick"... Ideas?
    Last edited by Taem; May 14th, 2013 at 09:14 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width