VB 过程太大的问题
Ifzs1=zz1ThenLabel2(i).BackColor=&HFF&Label2(i).ForeColor=&HFFFFFFLabel2(i).Caption=z...
If zs1 = zz1 Then
Label2(i).BackColor = &HFF&
Label2(i).ForeColor = &HFFFFFF
Label2(i).Caption = zs1
i1 = 0
Else
Label2(i).BackColor = &HC0FFFF
Label2(i).ForeColor = &H404040
Label2(i).Caption = i1
End If
If zs1 = zz2 Then
Label3(i).BackColor = &HFF&
Label3(i).ForeColor = &HFFFFFF
Label3(i).Caption = zs1
i2 = 0
Else
Label3(i).BackColor = &HC0FFFF
Label3(i).ForeColor = &H404040
Label3(i).Caption = i2
End If
If zs1 = zz3 Then
Label4(i).BackColor = &HFF&
Label4(i).ForeColor = &HFFFFFF
Label4(i).Caption = zs1
i3 = 0
Else
Label4(i).BackColor = &HC0FFFF
Label4(i).ForeColor = &H404040
Label4(i).Caption = i3
End If
If zs1 = zz4 Then
Label5(i).BackColor = &HFF&
Label5(i).ForeColor = &HFFFFFF
Label5(i).Caption = zs1
i4 = 0
Else
Label5(i).BackColor = &HC0FFFF
Label5(i).ForeColor = &H404040
Label5(i).Caption = i4
End If
If zs1 = zz5 Then
Label6(i).BackColor = &HFF&
Label6(i).ForeColor = &HFFFFFF
Label6(i).Caption = zs1
i5 = 0
Else
Label6(i).BackColor = &HC0FFFF
Label6(i).ForeColor = &H404040
Label6(i).Caption = i5
End If
If zs1 = zz6 Then
Label7(i).BackColor = &HFF&
Label7(i).ForeColor = &HFFFFFF
Label7(i).Caption = zs1
i6 = 0
Else
Label7(i).BackColor = &HC0FFFF
Label7(i).ForeColor = &H404040
Label7(i).Caption = i6
End If
If zs1 = zz7 Then
Label8(i).BackColor = &HFF&
Label8(i).ForeColor = &HFFFFFF
Label8(i).Caption = zs1
i7 = 0
Else
Label8(i).BackColor = &HC0FFFF
Label8(i).ForeColor = &H404040
Label8(i).Caption = i7
End If
If zs1 = zz8 Then
Label9(i).BackColor = &HFF&
Label9(i).ForeColor = &HFFFFFF
Label9(i).Caption = zs1
i8 = 0
Else
Label9(i).BackColor = &HC0FFFF
Label9(i).ForeColor = &H404040
Label9(i).Caption = i8
End If
上面写不完,就是这样的判断语句共二千多条.用了一天的时间好不容易写完了.可是一执行就提示,过程太大.不能用,晕到.有没有方法简化这样的判断.谢谢.或者,如何可以设置过程行的大小值. 展开
Label2(i).BackColor = &HFF&
Label2(i).ForeColor = &HFFFFFF
Label2(i).Caption = zs1
i1 = 0
Else
Label2(i).BackColor = &HC0FFFF
Label2(i).ForeColor = &H404040
Label2(i).Caption = i1
End If
If zs1 = zz2 Then
Label3(i).BackColor = &HFF&
Label3(i).ForeColor = &HFFFFFF
Label3(i).Caption = zs1
i2 = 0
Else
Label3(i).BackColor = &HC0FFFF
Label3(i).ForeColor = &H404040
Label3(i).Caption = i2
End If
If zs1 = zz3 Then
Label4(i).BackColor = &HFF&
Label4(i).ForeColor = &HFFFFFF
Label4(i).Caption = zs1
i3 = 0
Else
Label4(i).BackColor = &HC0FFFF
Label4(i).ForeColor = &H404040
Label4(i).Caption = i3
End If
If zs1 = zz4 Then
Label5(i).BackColor = &HFF&
Label5(i).ForeColor = &HFFFFFF
Label5(i).Caption = zs1
i4 = 0
Else
Label5(i).BackColor = &HC0FFFF
Label5(i).ForeColor = &H404040
Label5(i).Caption = i4
End If
If zs1 = zz5 Then
Label6(i).BackColor = &HFF&
Label6(i).ForeColor = &HFFFFFF
Label6(i).Caption = zs1
i5 = 0
Else
Label6(i).BackColor = &HC0FFFF
Label6(i).ForeColor = &H404040
Label6(i).Caption = i5
End If
If zs1 = zz6 Then
Label7(i).BackColor = &HFF&
Label7(i).ForeColor = &HFFFFFF
Label7(i).Caption = zs1
i6 = 0
Else
Label7(i).BackColor = &HC0FFFF
Label7(i).ForeColor = &H404040
Label7(i).Caption = i6
End If
If zs1 = zz7 Then
Label8(i).BackColor = &HFF&
Label8(i).ForeColor = &HFFFFFF
Label8(i).Caption = zs1
i7 = 0
Else
Label8(i).BackColor = &HC0FFFF
Label8(i).ForeColor = &H404040
Label8(i).Caption = i7
End If
If zs1 = zz8 Then
Label9(i).BackColor = &HFF&
Label9(i).ForeColor = &HFFFFFF
Label9(i).Caption = zs1
i8 = 0
Else
Label9(i).BackColor = &HC0FFFF
Label9(i).ForeColor = &H404040
Label9(i).Caption = i8
End If
上面写不完,就是这样的判断语句共二千多条.用了一天的时间好不容易写完了.可是一执行就提示,过程太大.不能用,晕到.有没有方法简化这样的判断.谢谢.或者,如何可以设置过程行的大小值. 展开
7个回答
展开全部
晕,简化下程序吧,用那么多if语句干吗,多考虑一下循环,递归,分支判断吧......
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
能合并的合并
尽量使用select语句
看你好像有很多重复的语句
可以的话,把文件发给我看看
happyq6@qq.com
尽量使用select语句
看你好像有很多重复的语句
可以的话,把文件发给我看看
happyq6@qq.com
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询