473,387 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Embedded user controls

c#, .Net 2.0, VS2008

I have a user control, and wish to embed other custom/user controls
within this control.

I am getting problems in compilation though, that the type or
namespace cannot be found.

I have used the same namespace for both components.

Everything compiles and works fine with each of the respective user
controls used in the main project. The main control is derived from
TabPage, and one of the embedded controls is derived from CheckBox.

Any way of resolving this?
Nov 29 '07 #1
3 2231
On 2007-11-29 13:48:08 -0800, Dave Kelly <Da**********@googlemail.comsaid:
c#, .Net 2.0, VS2008

I have a user control, and wish to embed other custom/user controls
within this control.

I am getting problems in compilation though, that the type or
namespace cannot be found.

[...]
Any way of resolving this?
Undoubtedly.

You haven't really offered much in the way of specifics, but generally
speaking you'll get a compilation error like that if you've failed to
be specific enough about the namespace for some type you're using, or
you've failed to add a necessary reference to the project (under
"References" in the Solution Explorer).

If the former, you can solve that either by providing the fully
qualified name for the namespace before the type, or you can provide an
appropriate "using" statement at the beginning of the source file.

Not knowing the exact error, it's impossible to know what namespace or
reference hasn't been included. But it may be as simple as needing to
add a reference to the assembly for your custom control.

Pete

Nov 29 '07 #2
On 29 Nov, 23:35, Peter Duniho <NpOeStPe...@NnOwSlPiAnMk.comwrote:
On 2007-11-29 13:48:08 -0800, Dave Kelly <Dave.a.Ke...@googlemail.comsaid:
c#, .Net 2.0, VS2008
I have a user control, and wish to embed other custom/user controls
within this control.
I am getting problems in compilation though, that the type or
namespace cannot be found.
[...]
Any way of resolving this?

Undoubtedly.

You haven't really offered much in the way of specifics, but generally
speaking you'll get a compilation error like that if you've failed to
be specific enough about the namespace for some type you're using, or
you've failed to add a necessary reference to the project (under
"References" in the Solution Explorer).

If the former, you can solve that either by providing the fully
qualified name for the namespace before the type, or you can provide an
appropriate "using" statement at the beginning of the source file.

Not knowing the exact error, it's impossible to know what namespace or
reference hasn't been included. But it may be as simple as needing to
add a reference to the assembly for your custom control.

Pete
The situation is I have the source for both of the components in the
same project. Simplifying it, I have a control derived from the
TabPage, and another control derived from the CheckBox, which I wish
to programmatically place on the TabPage.

Both controls are in the same project, and using the same namespace.

I can use either control in any part of the project (eg put the
derived checkbox on the mainform), just not use it in the custom
tabpage control.

Note: I am not trying to solve the specifics of how to add the
checkbox derived control, but generically, as there are a few other
controls I wish to use on my derived TabPage.

Even when I tried to use a DLL of the custom controls, and referenced
the assembly in the project, I still got the same error.
Nov 30 '07 #3
On 2007-11-30 02:44:30 -0800, Dave Kelly <Da**********@googlemail.comsaid:
[...]
Even when I tried to use a DLL of the custom controls, and referenced
the assembly in the project, I still got the same error.
As I wrote, this is usually not a difficult thing to fix. The
compilation error provides detailed information that should lead you to
a solution.

But you haven't provided enough information here for anyone else to
answer the question. The exact wording of the compilation error and a
concise-but-complete sample of code demonstrating the problem would be
required.

You claim that both controls are in the same project and in the same
namespace. If so, then you've either got a typo or a conflicting name
or you've failed to completely qualify a nested type or you're wrong
about them being in the same project and namespace. As you can see,
there are a variety of things that could cause the error you're
describing and so there's no way for anyone else to know which of those
problems is actually the issue as long as you continue to withhold the
important details.

Pete

Nov 30 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

26
by: jini us | last post by:
Hi, I am starting a new project where I intend to use embedded database server in my win32 application. I intend to use VC++ microsoft studio 6.0 as my development environment. The...
11
by: Mark Yudkin | last post by:
The documentation is unclear (at least to me) on the permissibility of accessing DB2 (8.1.5) concurrently on and from Windows 2000 / XP / 2003, with separate transactions scope, from separate...
0
by: Chris Schremser | last post by:
I have a question regarding embedded controls in IE. We are looking to replace a small VB ActiveX control with something written in C#. We have written the control and it instantiates correctly...
5
by: A Lonely Programmer | last post by:
Hi group, Consider the following code: Dim dirinfo As New DirectoryInfo("c:\test") Dim fileinfo() As FileInfo = dirinfo.GetFiles Dim fi As FileInfo
59
by: Jeff Bowden | last post by:
For ease of configuration and other reasons, I would like for my single-user GUI app to be able to use postgresql in-process as a library accessing a database created in the users home directory. ...
2
by: SAL | last post by:
I would like to create a VB.net function, that builds a dynamic hyperlink using System.Web.UI.WebControls.HyperLink, but I can not find any examples on how to generate a dynamic hyperlink. Has...
0
by: Steven Spits | last post by:
Hi, I'm creating an embedded control for IE in VS 2005. For testing purpose, I have left the user control completely blank and only changed the background color. When navigating to the page...
0
by: joshusdog | last post by:
I need some advice about how to go about architecting a solution to the following problem. I'd like to create an application that has an interactive listener/ console window in which the user...
2
by: zb | last post by:
I have my code directory structured this way App App\Pages <- contains ASPX files App\Pages\Common App\Pages\Common\Controls <- has user controls App\Pages\Common\Controls\SupportingJS <- has...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.