473,320 Members | 1,744 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.

mdiParent/Child Forms - Argh

I'm new to VB.Net 2003 - (2 weeks in) so this MAY be straightforward...
(Things changed since Octal Assembler I see !!!)

I'll try to lay this out in a way that makes sense

I created a MdiParent form

In that form I want Child forms to apear BASED ON BUTTON Control Click Event

The Child needs to appear in the same location - Basically, turn ChildForm1
off and ChildForm2 on etc etc only one childform at a time

I have set StartPosition to Manual and entered the appropriate x,y

If I use the following code in the Main_Load Event of the mdiParent, the
form goes in the proper place - everything works great

Dim objDID As New fclDID
objDID.MdiParent = Me
objDID.Show()

Now, because I have many buttons (sounds like a silly thing to do, but in
this case...), I created two modules - one to Hide (or close - can't get
either to work - I want to close the 'old' form ideally) the old form and one
to show the new form (requested by the button click event)

So - basically the parent form holds the Click event, sets up some variables
- changes button colours etc etc and calls the Hide Sub in the Hide module
and then calls the Show sub in the Show module (both are public subs)

I traced the button click event to make sure that everything was passing
correctly - and it is

BUT

the child forms show up OUTSIDE the parent form - and when I try to
close/hide the 'old' form (by clicking a button on the parent), nothing
happens...

I have tried too many things to mention here - hehe - but one thing I should
mention is that I moved BOTH Public Subs out of the modules and into the
mdiParent code and that did NOT change anything

While I have not gone blind looking for answers, the medication is wearing
off and I could really use some help !!!!

Cheers

Scott

Nov 21 '05 #1
1 1752
Break it apart and start with a more simplistic approach, then add
functionality.

Class FrmMaster

private enum ToggleStates as integer
tsShowNone = 0
tsShowChild1 = 1
tsShowChild2 = 2
end enum

private m_ChildForm as Form
private m_ToggleState as ToggleStates = ToggleStates.tsShowNone

Sub cmdToggle_Click(sender, e)

dim myState as integer
dim fTop, fLeft, fHeight, fWidth as integer

myState = ctype(m_ToggleState, integer) + 1
if myState > 2 then myState = 0

m_ChildForm.Close
m_childForm.Dispose

select case myState
case ToggleStates.tsShowNone
case ToggleStates.tsShowChild1

m_childform = new frmChild1
m_childform.mdiParent = me

fTop =
fLeft =
fHeight =
fWidth =

case ToggleStates.tsShowChild2

m_childform = new frmChild1
m_childform.mdiParent = me

fTop =
fLeft =
fHeight =
fWidth =

end select

if not m_childForm is nothing then
m_childform.show
m_childform.Startuposition = FormStartPosition.Manual
m_childform.top = fTop
m_childform.left = fLeft
m_childform.height = fHeight
m_childform.width = fWidth
end if

end Sub

End Class
"PDP-8E" <PD***@discussions.microsoft.com> wrote in message
news:DA**********************************@microsof t.com...
I'm new to VB.Net 2003 - (2 weeks in) so this MAY be straightforward...
(Things changed since Octal Assembler I see !!!)

I'll try to lay this out in a way that makes sense

I created a MdiParent form

In that form I want Child forms to apear BASED ON BUTTON Control Click
Event

The Child needs to appear in the same location - Basically, turn
ChildForm1
off and ChildForm2 on etc etc only one childform at a time

I have set StartPosition to Manual and entered the appropriate x,y

If I use the following code in the Main_Load Event of the mdiParent, the
form goes in the proper place - everything works great

Dim objDID As New fclDID
objDID.MdiParent = Me
objDID.Show()

Now, because I have many buttons (sounds like a silly thing to do, but in
this case...), I created two modules - one to Hide (or close - can't get
either to work - I want to close the 'old' form ideally) the old form and
one
to show the new form (requested by the button click event)

So - basically the parent form holds the Click event, sets up some
variables
- changes button colours etc etc and calls the Hide Sub in the Hide module
and then calls the Show sub in the Show module (both are public subs)

I traced the button click event to make sure that everything was passing
correctly - and it is

BUT

the child forms show up OUTSIDE the parent form - and when I try to
close/hide the 'old' form (by clicking a button on the parent), nothing
happens...

I have tried too many things to mention here - hehe - but one thing I
should
mention is that I moved BOTH Public Subs out of the modules and into the
mdiParent code and that did NOT change anything

While I have not gone blind looking for answers, the medication is wearing
off and I could really use some help !!!!

Cheers

Scott


Nov 21 '05 #2

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

Similar topics

2
by: Terrance | last post by:
I'm hoping that there's someone out here that can help me with a coding problem. Here is the scenerio: I have a MdiParent Form on this MdiParent form there is a listview control and several text...
2
by: Terrance | last post by:
Good Day, I have a programming problem and need some help/advice. I have a MdiParent Form that has a tool bar with icons on it. I have a child form that needs set the toolbar enabled property to...
2
by: Venkatesh | last post by:
Hi All I have set a form as an mdicontainer which holds 5 other child forms .Every time I click the toolbar button to open a child form ,a new child form is instantiated.I would like to close the...
26
by: Paul Mars | last post by:
FormParent load opens FormChildA. FormChildA btn click opens FormChildB. (FormChildA and FormChildB are both children of FormParent) (FormChildA and FormChildB are different forms) Problem:...
1
by: Roy | last post by:
Hi all, I'm opening a mdichild (Form2) within another mdichild (Form1). In Form1 I have: Form2.MdiParent = Me.MdiParent 'No problem here .... .... If Form2.ShowDialog = DialogResult.OK Then 'I...
2
by: Steve Enzer | last post by:
My project uses a MDI parent form and several child forms. I need to call a public sub in the parent form (which is also the startup object) from one of the child forms in order to change the...
3
by: MuZZy | last post by:
Hi, I wounder if someone could help me here: app has an MdiParent form - i need to get some notification in form of an event when any MdiChild forms are added to/removed from...
1
by: mabond | last post by:
Hi I've noticed a couple of postings on this topic. I'm either not uderstanding them or I'm missing something. My app uses an MDIParent form (frmCAD). A menu item on frmCAD shows a child form...
1
by: John Patrick | last post by:
Hi I am trying to build an application which starts up with an MdiParent form, and then the user will Login to be able to open / close child forms as needed. Each child is to be connected to the...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.