Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,506 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,693 people online right now. Registration is fast and FREE... Join Now!




problem inheriting from Form

 
Reply to this topicStart new topic

problem inheriting from Form

king of loop
15 Aug, 2008 - 12:56 AM
Post #1

New D.I.C Head
*

Joined: 15 Jun, 2008
Posts: 16



Thanked: 1 times
My Contributions
Hi
I have built a form "frmBase" and within that form I have placed a TableLayOutPanel ("tableLayOutPanel1") ,and within the ("tableLayOutPanel1") I placed a panel control ("panel1").

The modifier panel1 and tabelLayoutpanel1 are set protrected.When I add another form to the program the new form I inherit from frmBase,as shown in the code below;
CODE

public class frmInherite : frmBase

{



                             public frmInherite()

                             {

                                InitializeConponents();

                             }

}




I can access tableLayoutPanel1 and panel1 which is placed above it by using the code below;



//th.panel1



But in design time I can’t drag any control from toolbox window to panel1 blink.gif
User is offlineProfile CardPM
+Quote Post

baavgai
RE: Problem Inheriting From Form
15 Aug, 2008 - 02:36 AM
Post #2

Dreaming Coder
Group Icon

Joined: 16 Oct, 2007
Posts: 2,031



Thanked: 105 times
Dream Kudos: 475
Expert In: C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua

My Contributions
All the controls in frmBase are probably private, which is the default. For an inherited form, this means they're locked. It also means the inherited form essentially can't see them. Make sure all the controls are declared "protected" rather than "private" and see how it goes. The controls are declared either in a region in frmBase.cs or in frmBase.Designer.cs.

Hope this helps.

User is offlineProfile CardPM
+Quote Post

king of loop
RE: Problem Inheriting From Form
15 Aug, 2008 - 02:52 AM
Post #3

New D.I.C Head
*

Joined: 15 Jun, 2008
Posts: 16



Thanked: 1 times
My Contributions
QUOTE(baavgai @ 15 Aug, 2008 - 03:36 AM) *

All the controls in frmBase are probably private, which is the default. For an inherited form, this means they're locked. It also means the inherited form essentially can't see them. Make sure all the controls are declared "protected" rather than "private" and see how it goes. The controls are declared either in a region in frmBase.cs or in frmBase.Designer.cs.

Hope this helps.



The modifier panel1 and tabelLayoutpanel1 are set protrected.

But in design time I can’t drag any control from toolbox window to panel1
User is offlineProfile CardPM
+Quote Post

nonggiatu
RE: Problem Inheriting From Form
15 Aug, 2008 - 06:27 PM
Post #4

New D.I.C Head
*

Joined: 7 Jun, 2008
Posts: 3


My Contributions
[/quote]


The modifier panel1 and tabelLayoutpanel1 are set protrected.

But in design time I can’t drag any control from toolbox window to panel1
[/quote]

Note: It's protected, not protrected.

I have tested your problem, I created two form, Form1 with a panel and Form2 that inherit from Form1. Then I built solution to creat DLL.
So, because the Panel in Form1 is private by default, in Form2, it is Locked and You cant drag any Item on it.
Then I opened file Form1.designer.cs, and changed property of Form1 from private to protected.
But that changing is not effect util you built solution. After I pressed Ctrl+Shift+B and re-opened Form2, I can drag control on Panel.
So, may be you had not built solution after change property of the Panel.
Hope this post is helpful for u.

User is offlineProfile CardPM
+Quote Post

king of loop
RE: Problem Inheriting From Form
16 Aug, 2008 - 03:16 AM
Post #5

New D.I.C Head
*

Joined: 15 Jun, 2008
Posts: 16



Thanked: 1 times
My Contributions
Regarding panel it works but not in TabelLayoutpanel ,and the reason is that tabelLayout does not support (work with) visual Inheritance,what can be done for the tabelLayout issue?


User is offlineProfile CardPM
+Quote Post

king of loop
RE: Problem Inheriting From Form
18 Aug, 2008 - 11:05 PM
Post #6

New D.I.C Head
*

Joined: 15 Jun, 2008
Posts: 16



Thanked: 1 times
My Contributions
Plz help me !!!!!!!!!!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 08:39PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month