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

Inherited Form - Question

I am starting to think my reason for an inherited form is flawed.

My original concept was this:
Create a form with a panel near the top with a button in the top right
corner, and then a panel in the middle.

( Basically a basic template of all my forms ).

So I created that form and compiled it.
Then I added an inherted form and made it inherit from the orig form.

Now I try to add a button to the main panel and cannot.
So I go back to the main form, change the modifiers from "Friend" to
"Protected" and then recompile and then go back to the designer.

Now I can add buttons to the main panel.
But now I can also resize the main panel, change the main panel, do anything
to the main panel. I wanted the panel to 'hold position',
and make it 'not changable' but still add items ontop of it.

So my initial idea does not work.
It seems I should just create a dummy form in my project, and when I want to
create a new form, just copy it.
As there really is no difference by me setting almost all the items on the
form to be "Protected".

Thanks,

Miro
Aug 22 '08 #1
2 1225
As I just typede this message I think I came up with a solution.

The 'Main Panel' I set to Friend, but then I added a panel ontop of it, and
Docked it within the Friend Panel, and made it Protected.

Thus, when inherting in the other form, I cannot easily change the panel
layout ( of where it is ) but still am able to add items to it.

Sorry for the posting(s). Sometimes it just seems to help to try to explain
it to someone to see the solution.

Miro

"Miro" <mi**@beero.comwrote in message
news:Oq**************@TK2MSFTNGP05.phx.gbl...
>I am starting to think my reason for an inherited form is flawed.

My original concept was this:
Create a form with a panel near the top with a button in the top right
corner, and then a panel in the middle.

( Basically a basic template of all my forms ).

So I created that form and compiled it.
Then I added an inherted form and made it inherit from the orig form.

Now I try to add a button to the main panel and cannot.
So I go back to the main form, change the modifiers from "Friend" to
"Protected" and then recompile and then go back to the designer.

Now I can add buttons to the main panel.
But now I can also resize the main panel, change the main panel, do
anything to the main panel. I wanted the panel to 'hold position',
and make it 'not changable' but still add items ontop of it.

So my initial idea does not work.
It seems I should just create a dummy form in my project, and when I want
to create a new form, just copy it.
As there really is no difference by me setting almost all the items on the
form to be "Protected".

Thanks,

Miro

Aug 22 '08 #2
Miro wrote:
My original concept was this:
Create a form with a panel near the top with a button in the top right
corner, and then a panel in the middle.
So I created that form and compiled it.
Then I added an inherted form and made it inherit from the orig form.
Now I can add buttons to the main panel.
But now I can also resize the main panel, change the main panel, do
anything to the main panel. I wanted the panel to 'hold position',
and make it 'not changable' but still add items ontop of it.
You're heading in the /right/ direction!

Take control of the Layout of your Base Form:

Protected Overrides Sub OnLayout( _
ByVal e as LayoutEventArgs _
)
' Let VB do it's thing ...
MyBase.OnLayout( e )

' ... then put things where you want them to be!
With Me.MainFrame
.Location = ...
.Size = ...
End With

' ... and so on ...

End Sub

This code will run even in the Designer so Developers can't go
rearranging your form - the Layout code will simply put it straight back
again.

HTH,
Phill W.
Aug 26 '08 #3

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

Similar topics

2
by: Terrance | last post by:
Hello all I have a question I'm hoping someone can shed some light on. I have 2 user Inherited Controls on a form. When I click 1 inherited control I would like to change the text of the other...
3
by: Wojciech Trelak | last post by:
Hi, Does anyone know how to change an owner of a control inherited from the base form? In code it's simple, but the real question is how to force designer to do this? Is it possible? I tried...
1
by: RRiness | last post by:
I'm trying to use a template form I created. When I add an inherited form to my project, I get the error: Object reference not set to an instance of an object. when the inherited form is...
13
by: Lorne Smith | last post by:
Hi, First, sorry for the crosspost, but it seemed appropriate... :) I've come accross what I consider to be a bug, but I don't know if it's already known or not. (VS .Net 2003 Pro - VB.Net) ...
8
by: Spam Trap | last post by:
I am getting strange resizing problems when using an inherited form. Controls are moving themselves seemingly randomly, but reproducibly. "frmBase" is my base class (a windows form), and...
3
by: M O J O | last post by:
Hi, I've created a MasterForm which all my forms in my project must derive from. In my MasterForm, I've overloaded the New event with this code: Public Sub New(ByVal SomeText As String)...
0
by: Tony Johansson | last post by:
Hello! I have a very specific question and that is about how to inherit a visual control for example the control System.Windows.Forms.TextBox without causing the environment to delete the...
0
by: MikeY | last post by:
Hi everyone, I posted a question very early today, but maybe I wasn't articulate enough. Hopefully this will illicit a response I've created a windows form and a User Control. This is a...
4
by: asad.naeem | last post by:
hi to all this is the problem about inheritence. I have designed a form with some essential controls which are required for every form which will inherited from it. for example i have Button1 on...
0
by: Paul W | last post by:
Hello everyone, My problem is with an inherited Form. The base Form has a few controls on it that are anchored such that they move as the Form is resized. While in the designer, the inherited...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.