Wrox Programmer Forums
BOOK: Visual Basic 2010 Programmer's Reference
This is the forum to discuss the Wrox book Visual Basic 2010 Programmer's Reference by Rod Stephens; ISBN: 9780470499832
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2010 Programmer's Reference section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 23rd, 2012, 10:42 PM
Registered User
Join Date: Dec 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default User Control Constant Error Correction


I have a project that I am designing a User Control to use within. I started a Windows Forms Project, then I am laying out the User Control in-project. I don't want to compile the user control as a DLL, I want to keep it as a part of my final form project.

The problem I have is: Every time I run the project, an Exception Error pops up which says "Type 'ApplicationName.ControlOnFormName' is not defined. If I select the top suggestion... It changes the Form Designer code as follows:

Me.ControlOnFormName = New ProjectName.UserControlName()

Me.ControlOnFormName = New Global.ProjectName.UserControlName()

Now... The application will run fine, over and over, until I close the Form Designer. The Form Designer, upon closing, sets the code back to the top line. (No Global)

(Which is the never-ending loop: I correct - It runs fine - I close the Designer - It errors...) Now... The .exe file always runs if I build after the correction... : : stumped : :

Why does this happen??? And... is there a better way to keep a User Control within the project without having to reference a dll????

Ken C
Madison WI
Old January 24th, 2012, 10:31 AM
Rod Stephens's Avatar
Wrox Author
Join Date: Jan 2006
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts

Pretty weird. What is the name of the control class? All I can think of right now is that it might be a reserved word. It adds Global to differentiate it from something else but then the designer isn't smart enough to preserve that change (which seems likely because it's an error correction change).

If that's what's happening, you should be able to get around it by changing the name of the class.

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Old January 24th, 2012, 09:31 PM
Registered User
Join Date: Dec 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts


I appreciate your reply... I am at odds with this problem, as it is the third project that this error has occurred where I attempt to include a User Control. It has to be something I do as a habit that is 'BAD'.

(Background: I am just now switching from Classic VB to .NET... I am 49 years young - and hate the fact that yet another thing in my life is being called 'Classic'. Feeling old...)

I realize you are busy... I stripped down the project to a bare minimum and removed the unnecessary files. It is the start of s simple label printing project I am using to learn the ways of .NET....

I uploaded it temporarily to this location.


I would really like an answer to this... It is driving me nuts!

Thanks in advance, if you can look in to it,

Old January 24th, 2012, 10:08 PM
Registered User
Join Date: Dec 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

note.... If you ignore the error upon opening the form (Click to ignore), you can then then see the issue by: switching to the form design from anything else... The designer code automatically corrects, which makes the project not run until you use the suggested 'fix' to add the GLOBAL piece to the control 'Load NEW' line........ (If that makes any sense!!)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in User Control Edward Colins BOOK: Beginning ASP.NET 4 : in C# and VB 9 September 26th, 2010 08:40 AM
Error adding Report Viewer Control in Web User Con everest ASP.NET 2.0 Professional 0 January 29th, 2008 07:24 PM
Add Windows User control in Web User Control agarwalvidhu C# 0 March 30th, 2006 01:17 AM
User Control Syntax error g2000 BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 December 22nd, 2005 06:04 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.