Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > Pro VB.NET 2002/2003
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro VB.NET 2002/2003 For advanced Visual Basic coders working .NET version 2002/2003. Beginning-level questions will be redirected to other forums, including Beginning VB.NET.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old September 22nd, 2003, 04:41 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Control Id not working

I created a user control (ascx file) consisting of a panel and a few text boxes. After placing the control on a web form (aspx file), I cannot reference it in the codebehind file. I receive the error "Name wucPersonalInfo1 is not declared." If I run the application anyway, I receive the following runtime error: "Could not load type 'wucPersonalInfo'." The ascx file is in the same project as the aspx file. Nothing has been compiled yet.

Any ideas?

Thanks, Brandon

Reply With Quote
  #2 (permalink)  
Old September 22nd, 2003, 06:26 PM
Registered User
 
Join Date: Jun 2003
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

duncanthescott:

You probably need to add a reference to your ascx file in your aspx project. Select the Project menu >> select Add Reference >> select Projects tab >> click Browse, find and select your ascx file, then click OK. Your project aspx should now recognize your ascx file.
Reply With Quote
  #3 (permalink)  
Old September 23rd, 2003, 09:04 AM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jim,

Thanks for the suggestion, but the ascx file is contained within the project.

Reply With Quote
  #4 (permalink)  
Old September 23rd, 2003, 10:14 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,413
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Can you post your code for the ASPX?

Do you have a "@ Register" directive on the page?

Peter
Reply With Quote
  #5 (permalink)  
Old September 23rd, 2003, 11:44 AM
Imar's Avatar
Wrox Author
Points: 71,164, Level: 100
Points: 71,164, Level: 100 Points: 71,164, Level: 100 Points: 71,164, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 16,948
Thanks: 79
Thanked 1,555 Times in 1,532 Posts
Default

There is a bug in VS.NET. It doesn't add a declaration for a user control to the code behind when you add it. It does so for other controls like text boxes etc.

Manually add the following code to the top of your Class definition (near the other Controls).


Protected Your.Name.Space.YourControl YourControl1

By default, the VS.NET adds YourControl1 as the ID for a user control called YourControl. Make sure that the name of the control matched the code in the Code Behind.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Session ID swapping from user to user... greenwar VS.NET 2002/2003 3 September 7th, 2007 08:44 AM
User control ID collision arcuza ASP.NET 1.0 and 1.1 Professional 1 May 26th, 2006 08:00 AM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 12:17 AM
Face ID Code not working for me kencjohnson Excel VBA 0 December 29th, 2005 07:35 PM



All times are GMT -4. The time now is 10:44 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.