如何在VB6中设置验证

如何在VB6中设置验证,vb6,Vb6,我需要代码设置一个限制,不允许用户在文本框中将空ID和用户名作为ID lo-gin保存在所需的字段中?试试这个 if trim(text1.text) ="" then 'message here text1.setfocus end if 您可以在验证时验证它 Private sub Validate_Click() // verify username If trim(Username.text) = "" then Msgbox ("Please e

我需要代码设置一个限制,不允许用户在文本框中将空ID和用户名作为ID lo-gin保存在所需的字段中?

试试这个

   if trim(text1.text) ="" then
    'message here
    text1.setfocus
    end if

您可以在验证时验证它

Private sub Validate_Click()

// verify username
If trim(Username.text) = "" then
   Msgbox ("Please enter a username.")
   Username.focus()
   End sub
end if

// Verify password 
If trim(pwd.text) = "" then
   Msgbox ("Please enter a password.")
   pwd.focus()
   End sub
end if

-- Your codes

End sub

你至少应该试着写一些代码。