请问各位大侠这道题应该怎么做?谢谢

解决方案 »

  1.   

    处理文本框的mousedown事件,利用seltext就能知道选中的是什么.
      

  2.   

    Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
        If Text1.SelText = "A" Then
            Debug.Print "设置按钮Enabled属性为true"
        End If
    End Sub
      

  3.   

    谢谢楼上两位的回答。
    但是有几个问题还是不懂。。
    1.恰好选中一个英文字母
    其中
    "恰好"要求不能多不能少只能只选一个字母的时候才能使 Command1.Enabled = true
    "英文字母"要求选择非英文字母的时候 Command1.Enabled = False
    2.LCase和UCase单独使用就会,但是要如何实现自动判断大小写以作出对应的对次两个函数的选择呢?刚上第二节计算机课还有很多不会的。。
    谢谢~
      

  4.   

    1.用text1.sSelLength=1 判断是否为选取了一个字符
    至于是否为字符 用Ascii 码判断
    A~Z=65~90,a~z=97~122
    如asc(text1.seltext)=65 即 选取了A
    同理判断选取了1个字母:
    if asc(text1.text)>=65 and asc(text1.text)<=90 or  asc(text1.text)>=97 and asc(text1.text)<=122 then2 判断大小写还是ascii码判断
    假如选取的是a
    if Asc(ucase(text1.seltext))=Asc(text1.seltext) then 
    msgbox "这个字母是大写"
    else
    msgbox "这个字母是小写"
    end if
    Private Sub Command1_Click()
    If Asc(UCase(Text1.SelText)) = Asc(Text1.SelText) Then
        MsgBox "这个字母是大写 现在变为小写"
        Text1.SelText = LCase(Text1.SelText)
    Else
        MsgBox "这个字母是小写 现在变为大写"
        Text1.SelText = UCase(Text1.SelText)
    End If
    Command1.Enabled = False
    End SubPrivate Sub Form_Load()
    Text1.Text = "AasDFG#@Ui&*(123"
    Command1.Enabled = False
    End SubPrivate Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If Len(Text1.SelText) = 1 Then
        If Asc(Text1.SelText) >= 65 And Asc(Text1.SelText) <= 90 Or Asc(Text1.SelText) >= 97 And Asc(Text1.SelText) <= 122 Then
            MsgBox "你选取了一个字母"
            Command1.Enabled = True
        End If
    End If
    End Sub