Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27102

VS 2010 Looking for an easier way to nestle multiple If statements

$
0
0
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?

Viewing all articles
Browse latest Browse all 27102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>