Click here to Skip to main content
15,886,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I keep getting the following error message when setting up text boxes.
Error 'txtEmployeeID' is not declared. It may be inaccessible due to its protection level.	

This is my code:
VB
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
    Dim HomePhone As String
    HomePhone = txtHomePhone.Text
End Sub

Any help you can give would be appreciated.
Posted
Updated 11-Aug-11 23:23pm
v3
Comments
Soft009 11-Aug-11 23:46pm    
There is no 'txtEmployeeID' in your code.... where is it..
Dr.Walt Fair, PE 12-Aug-11 0:00am    
Please show the section of code that actually has txtEmployeeID in it. Where is it supposedly defined?

1 solution

your handles statement is missing the handles Textbox2.TextChanged

VB
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)



Note: This normally happens when you delete the control from the form, it removes the Handles event in the sub's header.


It should have something like this
VB
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

   End Sub
 
Share this answer
 
Comments
thatraja 12-Aug-11 14:18pm    
Spot on, 5!

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