以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [讨论]代码优化  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=122227)

--  作者:YDS
--  发布时间:2018/7/21 9:14:00
--  [讨论]代码优化
感觉以下代码很是别扭,却又不知道该如何优化,请高手指点,谢谢!

Dim s,s1,s2,s3,mj,gz,qt As String
s1 = "产品名称|80|商标要求|80|色彩要求|80|特殊要求|80|订购数量|70|折扣|40|"
s3 = "中心孔|60|孔间距|60|安装孔|60|孔数量|60"
mj = "模具|40|"
gz = "工装|40|"
qt = "其他|40|"
If e.Form.Controls("CheckBox3").checked = True Then
    If e.Form.Controls("CheckBox4").checked = True Then
        If e.Form.Controls("CheckBox5").checked = True Then
            s2 = mj & gz & qt
        Else
            s2 = mj & gz
        End If
    Else
        If e.Form.Controls("CheckBox5").checked = True Then
            s2 = mj & qt
        Else
            s2 = mj
        End If
    End If
Else
    If e.Form.Controls("CheckBox4").checked = True Then
        If e.Form.Controls("CheckBox5").checked = True Then
            s2 = gz & qt
        Else
            s2 = gz
        End If
    Else
        If e.Form.Controls("CheckBox5").checked = True Then
            s2 = qt
        Else
            s2 = ""
        End If
    End If
End If
s = s1 & s2 & s3
e.form.controls("Table1").Table.SetColVisibleWidth(s)

--  作者:有点蓝
--  发布时间:2018/7/21 9:19:00
--  
也就这样了
--  作者:YDS
--  发布时间:2018/7/21 9:32:00
--  
好的   谢谢