MDI Form Size and Other Issues...
I have a Main MDI and rest forms are child MDI
Now I have to do the following.. Please help on that :
1) All the MDI Child SHOULD NOT HAVE the minimize, maximize and close button which is on the top right corner of every SDI form.. so that he cannot close the child forms via that..
2) When the MDI opens and loads any MDI child in it, the Size of the Child MDI is small , so the full size does not show.. What I want is that the Parent MDI and child MDI auto resize themself so that the full form shows whenever diff child MDI are opened..
3) How do u code an Msg Box in the Parent MDI close ( X ) Button on top right so that a msgbox opens confirming exit of the program before closing it..
4) I have a Menu Made in Parent MDI.. Whenever a person clicks on a option there to open a form.. It should close the currently or all loaded child forms and load that particular form.. i.e. i don't want more than 1 child form open at any given time..
These queries are enough for right now.. so help guys..
Re: MDI Form Size and Other Issues...
Here's a start on a couple of your questions.
2)
MDIFormName.width = 50000
MDIFormName.height = 80000
MDIFormName.Activeform.width = 50000
MDIFormName.Activeform.height = 80000
3)
VB Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Select Case MsgBox("Exit Program ?", vbYesNo)
Case vbYes
Exit
Case vbNo
Exit Sub
End Select
End Sub
4)
Unload Me (unloads the active form)
Form1.show (shows another form)
Re: MDI Form Size and Other Issues...
1)
Set the MaxButton and MinButton properties of your MDIchild to False. Not sure about the close button.
Re: MDI Form Size and Other Issues...
1) set the ControlBox property to False at design time.
Re: MDI Form Size and Other Issues...
Quote:
Originally Posted by sgrya1
Here's a start on a couple of your questions.
2)
MDIFormName.width = 50000
MDIFormName.height = 80000
MDIFormName.Activeform.width = 50000
MDIFormName.Activeform.height = 80000
Does this code have to be only in parent MDI or all forms?? or in declaration module??
Re: MDI Form Size and Other Issues...
VB Code:
MDIFormName.Activeform.width = 50000
MDIFormName.Activeform.height = 80000
gives an error
"Object variable or With Block variable not set"
please help.. i have changed the mdiformname to my name..
that code maximizes the mdiform .. and i need all active form inside it to be in middle of it but not maximized .. a decent size.. but ALWAYS in center
Re: MDI Form Size and Other Issues...
You can put it in the Form_Load events of your forms.
The values of 50000 and 80000 are numbers that you will have to change until you get the right size. Using Me and putting the resize code in the right place will get rid of your error.
Your MDI form:
VB Code:
Private Sub MDIForm_Load()
Me.width = 50000
Me.height = 80000
end sub
Your Child Form:
VB Code:
Private Sub Form_Load()
Me.width = 50000
Me.height = 80000
' Center Form In Middle Of MDIform
Me.Move (MDIformname.ScaleWidth / 2) - (Me.Width / 2), (MDIformname.ScaleHeight / 2) - (Me.Height / 2)
end sub
Re: MDI Form Size and Other Issues...
VB Code:
Private Sub MDIForm_Load()
frmMDIChild.Show
frmMDIChild.Left = (Me.ScaleWidth - frmMDIChild.Width) / 2
frmMDIChild.Top = (Me.ScaleHeight - frmMDIChild.Height) / 2
End Sub