现在有一段IF语句如下:If Opt(0).Value = True Then
     。
 ElseIf Opt(1).Value = True Then    
     。
 ElseIf Opt(2).Value = True Then
     。
 End If如何将它改成SELECT CASE语句?select case xxxxx' 这里如何写?       case x' 这里如何写?       case x' 这里如何写?       case x' 这里如何写?
  end select
   

解决方案 »

  1.   


    select case Index  
      case 0
          MSGBOX 0
      case 1
          MSGBOX 1
      case 2   
           MSGBOX 2
    end select
      

  2.   

    这个地方就应该用if……else if 
      

  3.   

    Dim i%, tag%
    For i = 0 To opt.Count - 1
       If opt(i).Value Then tag = i: Exit For
    Nextselect case tag' 这里如何写?  case 0' 这里如何写?  case 1' 这里如何写?  case 2' 这里如何写?
      
    end select
      

  4.   

    这个判断的确只能用if...else if....end if
      

  5.   


    Option Explicit
    Dim intP As Integer
    Private Sub Command1_Click()
        Select Case intP
            Case 0
                
            Case 1
            
            Case 2
            
            Case 3
            
        End Select
    End SubPrivate Sub Option1_GotFocus(Index As Integer)
        intP = Index
    End Sub
      

  6.   

    应该放到click事件中,通过tab键移动也可以使其获得焦点。开始想到这法子的,觉得不是很方便。