vb 请老师过来看看多个复选框的问题

来源:百度知道 编辑:UC知道 时间:2024/06/21 00:47:21
Private Sub Command20_Click()

Dim i&, j&, m&, ts$(2), n() As Byte
Dim tn(2) As String

ts(0) = "01234"
ts(1) = "56789"
ts(2) = ""

For i = List1.ListCount - 1 To 0 Step -1
If Form3.Check1.Value = 1 Then
tn(0) = 3
tn(1) = 0
tn(2) = 0

End If
If Form3.Check2.Value = 1 Then
tn(0) = 2
tn(1) = 1
tn(2) = 0
End If
If Form3.Check3.Value = 1 Then
tn(0) = 0
tn(1) = 3
tn(2) = 0
End If
If Form3.Check4.Value = 1 Then
tn(0) = 1
tn(1) = 2
tn(2) = 0
End If

n = StrConv(List1.List(i), 128)

For j = 0 To 2
For m = 0 To 2
If InStr(ts(m), Chr(n(j))) > 0 Then tn(m) = tn(m) - 1
Next
Next
If tn(0) = 0 And tn(1) = 0 And tn(2) = 0 Then Else List1.RemoveItem i

Next
End Sub
解释如下:
tn(0) = 3
tn(1) = 0
tn(2) = 0

你的编程思路有问题,复杂化了,想想怎么简单点吧。

编程不仅在直接解决问题,还有思维逻辑和运行效率问题。

你想实现什么功能,做什么用?描述情况发贴出来,或者发邮件给我:chybing@163.com

a