vb 关于乾坤大翻转问题请老师过来看看

来源:百度知道 编辑:UC知道 时间:2024/06/21 03:17:04
Private Sub Command2_Click()
Dim i As Integer
Dim strTemp As String
s = Right$(Combo1.Text, 3)
strTemp = strTemp & s & ","
For i = 0 To 11
If Check1(i) Then
strTemp = strTemp & Check1(i).Caption & ","
End If
Next i

If Len(strTemp) = 0 Then
MsgBox "请选择复选条件"
Exit Sub
End If

For i = 0 To 2
If Option1(i).Value = True Then
strTemp = strTemp & Option1(i).Caption
End If
Next i

List1.AddItem strTemp
End Sub
这段代码是把 s,Check1(i).Caption ,Option1(i).Caption添加到list中
如LIST中现在显示
268,语文,数学,美术,3
358,数学,体育,物理,化学,2
其中268=s,语文,数学,美术分别是刚才所选的Check1(i).Caption,3是 Option1(i).Caption
现在已经选完了第二项358那行,我看第一项268这行不合适,要求修改,这时点击list中的268,语文,数学,美术,3 这一行,那么Combo1将回到268这行,Check1(i)也要对应Check1(i)

Private Sub List1_Click()
dim str as string,ss() as string
dim i as interger
str=list1.text
ss=split(str,",")
for i=0 to n
if check1(i).caption=ss(0) then
check1(i).value=1
exit for
end if
next i
end sub
上述for循环只判断了check1(i)对应于list1中的相应内容,其他控件的改变请自行添加代码