当“当前天”为空时,我试图禁用“基本费率”文本框 并在有一些数字时启用它。即时通讯有一个问题,当我把数字放在目前的日子,它将无法启用基本汇率的文本框。
Private Sub UserControlAdminPayroll_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If txtPresentDays.Text = "" Then
txtBasicRate.Enabled = False
Else
txtBasicRate.Enabled = True
End If
End Sub
答案 0 :(得分:2)
您需要每次检查txtPresentDays.Text
的更改。试试这个:
Private Sub txtPresentDays_TextChanged(sender As Object, e As EventArgs) Handles txtPresentDays.TextChanged
txtBasicRate.Enabled = Not String.IsNullOrEmpty(txtPresentDays.Text)
End Sub
别忘了在启动时将txtBasicRate.Enabled
设置为适当的值。