我想学VB,大家给点建议,我没有基础,不知可不可以!
此外,问个小问题:
'第一个文本框是否为空
Private Sub Command1_Click()
   If Trim(Text1.Text) = "" Then
      smsg = "enter a number"
    End If
'第二个文本框是否为空
   If Trim(Text2.Text) = "" Then
      smsg = "enter again"
    End If
'两次是否一直  
  If Trim(Text1.Text) <> Trim(Text2.Text) Then
     smsg = "invalid ,try again"
       Text1.Text.Clear
       Text2.Text.Clear
    End If
End Sub我置了两个text,一个command,为什么运行不过呢?老说无效的限定符,然后就指向Private Sub Command1_Click();
希望您不惜赐教我快没分了,就5分,实在不好意思!

解决方案 »

  1.   

    '第一个文本框是否为空
    Private Sub Command1_Click()
       If Trim(Text1.Text) = "" Then
          msgbox  "enter a number"
        End If
    '第二个文本框是否为空
       If Trim(Text2.Text) = "" Then
          msgbox = "enter again"
        End If
    '两次是否一直  
      If Trim(Text1.Text) <> Trim(Text2.Text) Then
         msgbox = "invalid ,try again"
           Text1.Text=""
           Text2.Text=""
        End If
    End Sub
      

  2.   

    帮你改一下
    Private Sub Command1_Click()
       dim smsg as string '你没定义啦
       If Trim(Text1.Text) = "" Then
          smsg = "enter a number"
        End If
    '第二个文本框是否为空
       If Trim(Text2.Text) = "" Then
          smsg = "enter again"
        End If
    '两次是否一直  
      If Trim(Text1.Text) <> Trim(Text2.Text) Then
         smsg = "invalid ,try again"
           text1.text=""
           text2.text=""
           'Text1.Text.Clear'没有这种方法吧
           'Text2.Text.Clear
        End If
    End Sub
      

  3.   

    其实应该还有msgbox
    Private Sub Command1_Click()
       dim smsg as string '你没定义啦
       If Trim(Text1.Text) = "" Then
          smsg = "enter a number"
          msgbox smsg'不然定义来干嘛?
          exit sub
        End If
    '第二个文本框是否为空
       If Trim(Text2.Text) = "" Then
          smsg = "enter again"
          msgbox smsg
          exit sub
        End If
    '两次是否一直  
      If Trim(Text1.Text) <> Trim(Text2.Text) Then
         smsg = "invalid ,try again"
         msgbox smsg
           text1.text=""
           text2.text=""
           'Text1.Text.Clear'没有这种方法吧
           'Text2.Text.Clear
        End If
    End Sub
      

  4.   

    Text1.Text.Clear
    Text2.Text.Clear
    不对!应该是:
    Text1.Text=""
    Text2.Text=""