473,395 Members | 1,457 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,395 software developers and data experts.

Abstratct UserControl Class Prevents WinForm Design View

Hi ,
I have multi level of UserControls.Say FORM1 is main form ,then UserControl1.
UserControl2:UserControl1 &
UserControl3:UserControl2

In UserContro2, there are some threading function which need to be overritten in UserControl3.So UserControl2 has been made abstract and that method too.
Now Application is running fine but ,I am not able to view the designer of UserControl3.The error message i m getting "[B]The designer must create an instance of type 'TestWinForm.UserControlLevel2' but it cannot because the type is declared as abstract. [/b]".
Because of this error I am not able to modify the Layout of UserControl3.

Please help .

Regards,
Gyanendar
Feb 22 '10 #1

✓ answered by ThatThatGuy

Instead of abstract you can try virtual keyword....

like this...
Expand|Select|Wrap|Line Numbers
  1. protected virtual void doSomething()
  2. {
  3. //////
  4. }
  5.  
this will enable the baseclasses to override doSomething() method....

You previosuly made the usercontrol class as abstract because you wanted the methods to be abstract...
because an abstract class cannot be instantiated the IDE is not able to create an instance of your user control.... SIMPLE

6 2509
tlhintoq
3,525 Expert 2GB
Have you tried changing from abstract to something else...
Do your design work...
Then change it back?
Feb 23 '10 #2
Thanks for the reply.
There are many functionality from abstract UserControl is reimplemented(by overide) in other UserControl.So changing the abstract is not possible as it will throw many errors & warnings.

Regards,
Gyanendar
Feb 23 '10 #3
ThatThatGuy
449 Expert 256MB
why even do you even want a user control to be abstract....
If you want to build greater functionalities from an exisiting control then i suppose there's no need for you to declare that control as abstract...

And rember OO concepts an abstract class can never be instantiated ...
That may be the reason you're getting this error
Feb 23 '10 #4
Yes as per OOPS concepts Abstract class can't be instantiated.
But without making it abstract,how we can override the function in another userControl ?
Feb 23 '10 #5
ThatThatGuy
449 Expert 256MB
Instead of abstract you can try virtual keyword....

like this...
Expand|Select|Wrap|Line Numbers
  1. protected virtual void doSomething()
  2. {
  3. //////
  4. }
  5.  
this will enable the baseclasses to override doSomething() method....

You previosuly made the usercontrol class as abstract because you wanted the methods to be abstract...
because an abstract class cannot be instantiated the IDE is not able to create an instance of your user control.... SIMPLE
Feb 23 '10 #6
yes, this will work.
Thanks
Feb 24 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Tom | last post by:
hi guys I am inheriting a toolbar winform control and I am simply setting the backcolor to transparent.. now I've created a new class and inherited it from toolbar. How do I compile this new...
0
by: Ryan Liu | last post by:
I have a user control, it must set a property when it is just created, so I set it in its constructor, which has an parameter to specify the property . For example: public class ExecQuest :...
4
by: oneeye | last post by:
Hello All, I have designed and built a web control that loads a user control at run time. The question I have is, can I Load the user control in design view? Any Ideas or code snippets would be...
4
by: Joel Barsotti | last post by:
On certain pages I want to have a user control that is derived not directly from the usercontrol class, but from a class that extends the UserControl class so my objects will have a some...
1
by: Luis Ferrao | last post by:
Happy new year everyone. I'm building a templated website. For each individual content page I have a UserControl that holds the content. The UserControl inherits from a custom PlaceHolder...
4
by: Ken McCrory | last post by:
I have a page with some inline server-side code. An example line is: <input type="hidden" name="fmFirstName" value="<%=Session("FirstName")%> "> The code and logic works and does what it is...
4
by: anton.hopen | last post by:
ASP.NET 2.0 master pages are great. However, I want to edit an ASPX page in FrontPage for aesthetic styling reasons. The ASPX page is linked to a master page so it naturally has a...
0
by: mikrogen | last post by:
Am I the only one, who is upset with Design view in Visual C++? There is so many bugs, that it is almost unusable (both VC express and VS Professional), .. I.e. - you cannot use usercontrol...
1
by: Nogusta123 | last post by:
Hi, I have had a lot of problems getting web pages, master pages and content pages to render in VS2005 design view the same as they would in Internet Explorer. I did a lot of looking on the...
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
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.