VB中的两个“复选框(Checkbox,Optionbutton)”是怎么使用的?

2025-05-23 05:29:52
推荐回答(2个)
回答1:

代码如下:
Private
Sub
Command1_Click()
If
Option1.Value
=
True
Then
MsgBox
"你选择了复选框"
 
 
 
 
 
 
 
 
‘如果Option1被选中,则弹出消息框
If
Check1.Value
=
1
Then
 
 
MsgBox
"你选择了复选框"
 
 
 
 
 
 
 
 
‘如果Check1被选中,则弹出消息框
else
if
Check1.Value
=
0
Then
 
 
MsgBox
"你选择了复选框"
 
 
 
 
 
 
 
 
‘如果Check1被选中,则弹出消息框
End
If
End
Sub
 
这个代码明白吗?

回答2:

代码如下:
Private
Sub
Command1_Click()
If
Option1.Value
=
True
Then
MsgBox
"你选择了复选框"

‘如果Option1被选中,则弹出消息框
If
Check1.Value
=
1
Then

MsgBox
"你选择了复选框"

‘如果Check1被选中,则弹出消息框
else
if
Check1.Value
=
0
Then

MsgBox
"你选择了复选框"

‘如果Check1被选中,则弹出消息框
End
If
End
Sub

这个代码明白吗?