vb check1 - 20

来源:百度知道 编辑:UC知道 时间:2024/05/27 08:40:27
我想 建 20个 check 控件 每个空间 连接一个EXE程序 选择后 按command1来执行 选择后的
Private Sub Command1_Click()
If Check1.Value = 1 Then
Shell ("C:\Documents and Settings\shawn_2008\桌面\程序\程序名字.exe") '路径
End If
End Sub

上边的 怎么把 Check2 或 Check3 多个控件加进去 点Command1执行啊

你可以多加几个if判断
If Check2.Value = 1 Then .....
If Check3.Value = 1 Then......
......
对应各自的程序

Private Sub Command1_Click()
If Check1.Value = 1 Then
Shell ("C:\Documents and Settings\shawn_2008\桌面\程序\程序名字.exe") '路径
End If
End Sub

你可以把check 控件作成数组
把程序路径放在另外一个数组,比如mAppPath里

然后
Private Sub Command1_Click()
for i = 0 to 19
If Check1(i).Value = 1 Then
Shell mAppPath(i)
End If
next i
End Sub