在豆包生成基础上修改,功能不完整。
Option Explicit
Private Sub Check1_Click() '计算机CheckBox控件(假设名称为Check1)
If Check1.Value = vbChecked Then
Combo1.Enabled = True
Text1.Enabled = True
Else
Combo1.Enabled = False
Text1.Enabled = False
End If
End Sub
Private Sub Check2_Click() '操作系统CheckBox控件(假设名称为Check2)
If Check2.Value = vbChecked Then
Option1.Enabled = True
Option2.Enabled = True
Else
Option1.Enabled = False
Option2.Enabled = False
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then '当按下回车键
Dim i As Integer
Dim isExist As Boolean
isExist = False
For i = 0 To Combo1.ListCount - 1
If Combo1.Text = Combo1.List(i) Then
isExist = True
Exit For
End If
Next i
If Not isExist Then
Combo1.AddItem Combo1.Text
List1.AddItem Combo1.Text
End If
Combo1.Text = ""
End If
End Sub
Private Sub Command1_Click() '确定按钮(假设名称为Command1)
Dim config As String
If Check1.Value = vbChecked Then
config = config & "计算机:品牌 " & Combo1.Text & ",数量 " & Text1.Text & vbCrLf
End If
If Check2.Value = vbChecked Then
If Option1.Value = True Then
config = config & "操作系统:Windows 2000" & vbCrLf
ElseIf Option2.Value = True Then
config = config & "操作系统:Windows XP" & vbCrLf
End If
End If
List1.Clear
List1.AddItem config
End Sub