我创建了一个包含4个复选框和1个文本框的简单用户窗体。
我希望能够根据点击的复选框显示句子。 如果checkSwimming池被检查,我想显示这个字符串: 打电话的人提到了游泳池。
如果选中复选框游泳池和复选框阳台,我想显示此字符串。
来电者提到游泳池。 来电者提到了阳台。
和儿子。
到目前为止,这是我的代码:
Private Sub CommandButton1_Click()
'If chkPool.Value = True Then
'txtComment.Text = "The caller asked about Swimming Pool."
'ElseIf chkBalcony.Value = True Then
'txtComment.Text = "The caller asked about Balcony and Patio."
'End If
Select Case test_test
Case chkPool.Value = True
txtComment.Text = "The caller asked about Swimming Pool."
Case chkPool.Value = True & chkBalcony.Value = True
txtComment.Text = "The caller asked about Swimming Pool."
txtComment.Text = "The caller asked about balcony."
End Select
End Sub
答案 0 :(得分:0)
这是你在找什么?
Private Sub CommandButton1_Click()
txtComment.Text = ""
If chkPool.Value = True Then
txtComment.Text = txtComment.Text & "The caller asked about Swimming Pool." & Chr(10)
End If
If chkBalcony.Value = True Then
txtComment.Text = txtComment.Text & "The caller asked about Balcony and Patio." & Chr(10)
End If
'... add more IF clauses for the other check boxes here...
End Sub
只需确保文本框为MultiLine = True
。