i am creating an UserControl in VB.net in which i have a textbox which contain properties like AllowOnlyNumeric,AllowOnlyCharacher etc so that i dont's have to code for these validations again n again plz give me some code to do that ASAP.
I am doing something like thisVB Code:
Private Sub TextBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) If varOnlyNumber = True Then 'If Char.IsLetter(CChar(TextBox1.Text)) = True Then TextBox1.Text = "" 'If IsNumeric(e.KeyValue) Then e.KeyData.Clear() End If If VarOnlyString = True Then If Char.IsDigit(CChar(TextBox1.Text)) = True Then TextBox1.Text = "" End If End Sub




Reply With Quote