Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hai i am creating windows form for staff registeration which this form is connected to database ,i want to put messagebox which if" Please put number in this field" in TELEPHONEtextbox.text .The reason is to inform the user that the data which user type is wrong if their type a string in this Telephonetextbox.text Any advice how i am to do it.Here is my code For your info I am using visual studio 2005 & sql 2005 as database .


VB
class admin
 Private Sub btnregister_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnregister.Click
        If Me.NAMETextBox.Text.Trim.Length = 0 Then
            MessageBox.Show(" Please Enter Fullname")
            Me.NAMETextBox.Focus()
         ElseIf ADDRESSTextBox1.Text.Trim.Length = 0 Then
            MessageBox.Show("Please Enter Address ")
            Me.ADDRESSTextBox1.Focus()
        ElseIf DEPARTMENTComboBox1.Text.Trim.Length = 0 Then
            MessageBox.Show("Please Choose Department")
            Me.DEPARTMENTComboBox1.Focus()
        ElseIf USERNAMETextBox1.Text.Trim.Length = 0 Then
            MessageBox.Show("Please Enter Username")
            Me.USERNAMETextBox1.Focus()
        ElseIf PASSWORDTextBox.Text.Trim.Length = 0 Then
            MessageBox.Show("Please Enter Password")
            Me.PASSWORDTextBox.Focus()
        End If

        Me.StaffTableAdapter.Insert(Me.NAMETextBox.Text, Me.DEPARTMENTComboBox1.Text, Me.I_CTextBox.Text, Me.USERNAMETextBox1.Text, Me.PASSWORDTextBox.Text, Me.ADDRESSTextBox1.Text, Today.Date.ToShortDateString, Today.Date.ToShortDateString)
        Me.StaffTableAdapter.Fill(Me.LoginDataSet.staff)
 
end sub
end class
Posted
Updated 9-Sep-11 13:22pm
v2

1 solution

Hi,
for this validation below link will be use full to you.

Numeric TextBox[^]
Wish to use text box to only allow numeric Data entry[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900