使用datatimepicker的问题
form里有两个控件,一个TextBox TextBox1 还有一个DataTimePicker dtp
' 当焦点离开text时进行检查,看其有没有入力,如果没有入力则报个messaege,并将背景色设成黄色。 Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating TextBox1.BackColor = Colo[code=VB.NET]
Private Sub TextBox1_Validating(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles TextBox1.Validating If TextBox1.Text.Length = 0 Then TextBox1.BackColor = Color.Yellow MsgBox("1001") e.Cancel = True End If End Sub