Click here to Skip to main content
15,895,283 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am new to ASP.net 4.5

I tried to cut and paste a 4.0 program and I found out That 4.5 does not like TextBoxes.

It declares textbox1 in Default.aspx.designer.vb with "Protected WithEvents".

How do I fix this error in 4.5 so I can use the textboxes.

Error Code:
'TextBox1' is not declared. It may be inaccessible due to its protection level
.
Posted
Comments
Kornfeld Eliyahu Peter 13-Jul-14 4:51am    
"Protected WithEvents" seems to be all right.
How do you (and from where) try to access the text-box when getting the error?
Richard MacCutchan 13-Jul-14 6:31am    
There is a good lesson to be learned here. Do not cut and paste code from the internet (or another program) and expect it to work immediately without any changes. There are lots of reasons why TextBox1 cannot be found in this program.
[no name] 13-Jul-14 7:58am    
This is precisely why you were told to get a book on programming and work through it.

1 solution

.NET 4.5 does not mind TextBoxes at all: It is just saying that there is no TextBox called "TextBox1" in your application.

Check your Default.apsx page and make sure that it contains a TextBox with that name, and that it is declared as runat="server"
 
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