Inheriting Forms

  • Thread starter Robert A. Boudra
  • Start date
R

Robert A. Boudra

I was working through one of the examples in Microsoft's VB.net resource
kit, following the instructions for adding an inherited form to a project.
The base form had a couple of Buttons one it. When I choose the "add
inherited form" option and select the base form, it creates a new instance
of the form just fine. I then added some additional controls to the new
form, and selected the Build option. As soon as the Build option is
completed, the two Buttons that were on the base form disappear from the new
form. Any idea what is going on?

Bob
 
H

Herfried K. Wagner [MVP]

* "Robert A. Boudra said:
I was working through one of the examples in Microsoft's VB.net resource
kit, following the instructions for adding an inherited form to a project.
The base form had a couple of Buttons one it. When I choose the "add
inherited form" option and select the base form, it creates a new instance
of the form just fine. I then added some additional controls to the new
form, and selected the Build option. As soon as the Build option is
completed, the two Buttons that were on the base form disappear from the new
form. Any idea what is going on?

Which modifier did you select for the controls on the base form
'(Modifier)' "property"? Do the buttons show up when running the
application?
 
R

Robert A. Boudra

I didn't make any changes to the Modifiers Property of the base form.
Apparently the default is "'Friend". After compiling, the buttons don't
show up on the new form either in design mode or during execution.

Bob
 
P

Peter Huang

Hi Robert,

I can not reproduce the problem, I test under the Windows XP+SP1,VS.NET 2003
Here is my reproduce steps.
1. add a button on form1
2. add form2 inherit from form1
3. add a buttn onto form2
4. set start object to form2
5. Press F5 to run the project
6. I can see button1 and button2 on the form2

Which version of VS.NET do you use?
Can you reproduce the problem with my steps?

Or can you modify your code as simple as possible as long as it can
reproduce the problem
and send to me by remove "online" from my email address.

If you have any concern, please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
R

Robert A. Boudra

I'm using VS.net 2003. I was able to reproduce your project and results
below without any problems. The example I am doing is an MDI application
and the inherited form is an MDI child form. Could this have anything to do
with it?

Bob
 
P

Peter Huang

Hi Robert,

I also try the MDI form, but I can not reproduce the problem.
Here is my test steps.
I have three forms(form1,form2,form3)

form3 is a MDI form and it is the start object
form1 has a button(Button1) on it.
form2 inherits form1 and it also add a Button2 onto it.

[Case1]
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fm2 As New Form2
fm2.MdiParent = Me
fm2.Show()
Dim fm1 As New Form1
fm1.Show()
End Sub
[Case2]
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim fm1 As New Form2
fm1.MdiParent = Me
fm1.Show()
Dim fm2 As New Form1
fm2.Show()
End Sub

The two cases will alwarys display correctly.(form1 will have one button,
and form2 will have two buttons)
To identify the problem, I hope you can send me your code for me to
reproduce the problem. I will appreicate your efforts.
You may reach me by removing "online" from my email address.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top