I have a form set up with couple parameters. I have set up my form with two option button "Rolling" and "One Time". I would like to set this up as a condition to select which case to use. For Example if "One time" is selected use select case WITHOUT extend ELSE use select case WITH EXTEND. The below code is what I have now not sure if I am doing this condition correctly.
If OnetimeOption.value = True Then
Select Case MonthComboBox.value
Case "Week One"
iCol = "BB"
Case "Week Two"
iCol = "BC"
Case "Week Three"
iCol = "BD"
Case "Week Four"
iCol = "BE"
Case "Week Five"
iCol = "BF"
Case "Week Six"
iCol = "BG"
Case "One Seven"
iCol = "BH"
Case "One Eight"
iCol = "BI"
Case "One Nine"
iCol = "BJ"
Case "One Ten"
iCol = "BK"
Case "One Eleven"
iCol = "BL"
Case "One Twelve"
iCol = "BM"
End Select
Else
nExtend = 1 'Set this as a default.
Select Case MonthComboBox.value
Case "Week One"
iCol = "BB"
nExtend = 12
Case "Week Two"
iCol = "BC"
nExtend = 11
Case "Week Three"
iCol = "BD"
nExtend = 10
Case "Week Four"
iCol = "BE"
nExtend = 9
Case "Week Five"
iCol = "BF"
nExtend = 8
Case "Week Six"
iCol = "BG"
nExtend = 7
Case "One Seven"
iCol = "BH"
nExtend = 6
Case "One Eight"
iCol = "BI"
nExtend = 5
Case "One Nine"
iCol = "BJ"
nExtend = 4
Case "One Ten"
iCol = "BK"
nExtend = 3
Case "One Eleven"
iCol = "BL"
nExtend = 2
Case "One Twelve"
iCol = "BM"
nExtend = 1
End Select
End If
答案 0 :(得分:1)
如果两个Select Cases使用相同的值集,我会以不同的方式编写它。但他们没有。但是,我会结合具有相同结果的案例。
var labels:[UILabel]()
override func viewDidLoad() {
super.viewDidLoad()
labels = [label01, label02, label03, label04]
// do stuff with the labels view
}