Hi! Is it possible to do a select case using two variables or parameters? For example, something like this:
Dim family As integer = familyProduct.SelectedItem.Value
Dim prod As integer = product.SelectedItem.Value
Select Case (family and prod)
Case 1 and 22
Response.Redirect("anotherPage.aspx")
Case 2 and 29
Response.Redirect("anotherPage2.aspx")
Case 3 and 36
Response.Redirect("anotherPage3.aspx")
...
End Select
Dim family As integer = familyProduct.SelectedItem.Value * 100
Dim prod As integer = product.SelectedItem.Value
Select Case (family + prod)
Case 122
Response.Redirect("anotherPage.aspx")
Case 229
Response.Redirect("anotherPage2.aspx")
Case 336
Response.Redirect("anotherPage3.aspx")
...
End Select
Dim family As integer = familyProduct.SelectedItem.Value
Dim prod As integer = product.SelectedItem.Value
Select Case True
Case (family = 1 And prod = 22)
Respnse.Write("input is 1 and 22")
Case (family = 2 And prod = 29)
Respnse.Write("input is 2 and 29")
Case (family = 3 And prod = 35)
Respnse.Write("input is 3 and 35")
...
End Select
cesark
Contributor
2976 Points
602 Posts
To do a select case using two variables or parameters
Jun 22, 2004 11:58 AM|LINK
Dim family As integer = familyProduct.SelectedItem.Value Dim prod As integer = product.SelectedItem.Value Select Case (family and prod) Case 1 and 22 Response.Redirect("anotherPage.aspx") Case 2 and 29 Response.Redirect("anotherPage2.aspx") Case 3 and 36 Response.Redirect("anotherPage3.aspx") ... End Select..But this code doesn' t work. Thanks, Cesarrox.scott
Contributor
6080 Points
1214 Posts
Re: To do a select case using two variables or parameters
Jun 22, 2004 04:05 PM|LINK
Dim family As integer = familyProduct.SelectedItem.Value * 100 Dim prod As integer = product.SelectedItem.Value Select Case (family + prod) Case 122 Response.Redirect("anotherPage.aspx") Case 229 Response.Redirect("anotherPage2.aspx") Case 336 Response.Redirect("anotherPage3.aspx") ... End Selectcesark
Contributor
2976 Points
602 Posts
Re: To do a select case using two variables or parameters
Jun 22, 2004 05:06 PM|LINK
Dim family As integer = familyProduct.SelectedItem.Value Dim prod As integer = product.SelectedItem.Value Select Case True Case (family = 1 And prod = 22) Respnse.Write("input is 1 and 22") Case (family = 2 And prod = 29) Respnse.Write("input is 2 and 29") Case (family = 3 And prod = 35) Respnse.Write("input is 3 and 35") ... End SelectThis code works.