vb中关于textbox和buton问题
我想设计成textbox中有数值则BTN为可见,若没有数值BTN不可见应该怎么写这个语句。
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If TextBox1.Text.Length = 0 Then '这里是关键
button1.Visible = False
Else : button1.Visible = True
End If
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
If TextBox1.Text.Length = 0 Then
button1.Visible = False
Else : button1.Visible = True
End If
End Sub
End Class 哈哈,终于作出来了