打印本文 打印本文  关闭窗口 关闭窗口  
VB中使复选框实现单选框功能
作者:佚名  文章来源:不详  点击数  更新时间:2008/10/22 21:39:10  文章录入:杜斌  责任编辑:杜斌

  下面考试大给大家贴出VB中使复选框实现单选框功能代码!
  Dim lastIndex%, bCheck As Boolean
  Private Sub chkHonbu_Click(Index As Integer)
  If bCheck3 Then Exit Sub Else bCheck3 = True
  If lastIndex3 <> Index Then
  chkHonbu(lastIndex3).Value = 0
  lastIndex3 = Index
  Else
  chkHonbu(Index).Value = 1
  End If
  bCheck3 = False
  End Sub
  方法2
  Private Sub Check1_Click()
  If Check1.Value Then Check2.Value = 0
  If Check1.Value = 0 And Check2.Value = 0 Then Check1.Value = 1
  End Sub
  Private Sub Check2_Click()
  If Check2.Value Then Check1.Value = 0
  If Check1.Value = 0 And Check2.Value = 0 Then Check2.Value = 1
  End Sub方法3(最强的方法)
  Private i As Integer
  Private Sub Check1_Click()
  i = i + 1
  If i = 1 Then
  Check2.Value = (Not Check2.Value) And 1
  i = 0
  End If
  End Sub
  Private Sub Check2_Click()
  i = i + 1
  If i = 1 Then
  Check1.Value = (Not Check1.Value) And 1
  i = 0
  End If
  End Sub来源:考
打印本文 打印本文  关闭窗口 关闭窗口