Parent child close minimize maximize

B

Bill

Hi

I have a parent child forms. I want the close, maximize, and minimize
buttons to be removed.
One the child form I have set the maximize and minimize buttons to false. I
have the child form mamiximze in the parent form. So then the maximized
button is still active. But I want the child form to fill the parent form
without the ability to close minimize or maximize the form like a default
page.

The buttons are removed when the child form is not maximized.

Thanks in advance

Bill


This is the parent form Load
Private Sub frmContainC_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Dim objChild As frmMain = New frmMain()

objChild.ControlBox = False

objChild.MdiParent = Me

objChild.Show()

End Sub



on the child form

Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

Me.ControlBox = False

End Sub

Protected Overrides ReadOnly Property CreateParams() As
System.Windows.Forms.CreateParams

Get

Dim cp As CreateParams = MyBase.CreateParams

Const CS_DBLCLKS As Integer = &H8

Const CS_NOCLOSE As Integer = &H200

cp.ClassStyle = CS_DBLCLKS Or CS_NOCLOSE

Return cp

End Get

End Property
 
C

Cor Ligthert

Bill,

That is the controlbox = false, however you have than direct as well to add
a cancel button on your form because that is in that as well.

Cor
 
B

Bill

Cor

Wahat I am trying to accompish is a Main form which the user will have to
click on the parent window to close the program. Because I don't want an
empty parent window

Bill
 
C

Cor Ligthert

Bill,

So why not do what I wrote?

Although in normal situations the closing of a child form should not close
the application.

Cor
 
B

Bill

Cor
I did put controlbox = false, but if the windowstate = maximized then the
maximized button is still available until it goes back to the normal window
size and then it it doesnt fit the window.

I was not wanting the child form to close the window I was wanting the
child form to stay open till the parent form is closed.

Bill
 
C

Cor Ligthert

Bill,

Show some code how you show the child form, maybe we can help you then now
it is to much guessing?

Cor
 
B

Bill

Hi Cor

I was able to get it to work. I rebuilt the form and did not set any of the
setting in the form design just set the items in the code and it worked for
my purpose

Thanks
Bill
 

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