本帖最后由 xyjh 于 2011-11-4 16:49 编辑 

有时候在多个多选框中某一时刻有且只能一个被选中,而又不原用下拉框来做.这时下面的代码也许对你有所帮助.
- Event Form1.CheckBox1.Click
- If Form1.CheckBox1.Value = 1 Then //checkbox1.value=1表示该多选框被选中
- Form1.CheckBox2.Value = 0 //checkbox1.value=0表示该多选框没被选中
- Form1.CheckBox3.Value = 0
- Form1.CheckBox4.Value = 0
- Else
- If Form1.CheckBox4.Value = 0 and Form1.CheckBox2.Value = 0 and Form1.CheckBox3.Value = 0 Then
- Form1.CheckBox1.Value =1
- End If
- End If
- End Event
- Event Form1.CheckBox2.Click
- If Form1.CheckBox2.Value = 1 Then
- Form1.CheckBox1.Value = 0
- Form1.CheckBox3.Value = 0
- Form1.CheckBox4.Value = 0
- Else
- If Form1.CheckBox4.Value = 0 and Form1.CheckBox2.Value = 0 and Form1.CheckBox3.Value = 0 Then
- Form1.CheckBox1.Value =1
- End If
- End If
- End Event
- Event Form1.CheckBox3.Click
- If Form1.CheckBox3.Value = 1 Then
- Form1.CheckBox2.Value = 0
- Form1.CheckBox1.Value = 0
- Form1.CheckBox4.Value = 0
- Else
- If Form1.CheckBox4.Value = 0 and Form1.CheckBox2.Value = 0 and Form1.CheckBox3.Value = 0 Then
- Form1.CheckBox1.Value =1
- End If
- End If
- End Event
- Event Form1.CheckBox4.Click
- If Form1.CheckBox4.Value = 1 Then
- Form1.CheckBox2.Value = 0
- Form1.CheckBox3.Value = 0
- Form1.CheckBox1.Value = 0
- Else
- If Form1.CheckBox4.Value = 0 and Form1.CheckBox2.Value = 0 and Form1.CheckBox3.Value = 0 Then
- Form1.CheckBox1.Value =1
- End If
- End If
- End Event
复制代码