B
Bruce Dumes
Ok, the subject line of this is pretty confusing, I'll admit.
I'm new to dotnet and VB. I've used this kind of construction in Perl a
zillion times over the years.
What I've got is something like this (not my entire code):
<MYCODE>
Sub setVisible(Stage As Integer)
Select Case Stage
Case 2
Panel1.visible = false
Panel2.visible = true
Panel3.visible = false
Case 3
Panel2.visible = false
Panel3.visible = true
Panel4.visible = false
Case 4
Panel3.visible = false
Panel4.visible = true
Panel5.visible = false
Case 5
Panel4.visible = false
Panel5.visible = true
Panel6.visible = false
End Select
End Sub
</MYCODE>
What I'd like is something like this:
<MYBETTERCODE>
Sub setVisible(Stage As Integer)
'If there were an eval, I might do this
eval("Panel" & Stage - 1 & ".visible") = false
eval("Panel" & Stage & ".visible") = true
eval("Panel" & Stage + 1 & ".visible") = false
End Sub
</MYBETTERCODE>
Is there a way to do this in dotnet VB?
Thanks!
I'm new to dotnet and VB. I've used this kind of construction in Perl a
zillion times over the years.
What I've got is something like this (not my entire code):
<MYCODE>
Sub setVisible(Stage As Integer)
Select Case Stage
Case 2
Panel1.visible = false
Panel2.visible = true
Panel3.visible = false
Case 3
Panel2.visible = false
Panel3.visible = true
Panel4.visible = false
Case 4
Panel3.visible = false
Panel4.visible = true
Panel5.visible = false
Case 5
Panel4.visible = false
Panel5.visible = true
Panel6.visible = false
End Select
End Sub
</MYCODE>
What I'd like is something like this:
<MYBETTERCODE>
Sub setVisible(Stage As Integer)
'If there were an eval, I might do this
eval("Panel" & Stage - 1 & ".visible") = false
eval("Panel" & Stage & ".visible") = true
eval("Panel" & Stage + 1 & ".visible") = false
End Sub
</MYBETTERCODE>
Is there a way to do this in dotnet VB?
Thanks!