473,516 Members | 3,277 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MDI with multiple child forms Q

I'm developing a survey program. Currently, I have the parent form and the
survey which consists of three forms. As the user moves from one "page" or
form to the next, I would like to allow the user to go back and correct any
entries. Ideally, I would like to just hide one form as the user moves on
to the next, then show it if they decide to go back. But the problem I am
having is referencing the hidden form.

On Parent form:

sub mmuStart_click(...)
dim frm2Child as new form 2
frm2Child.mdiparent = me
frm2child.show()
mmuStart.enabled = false
end sub

Form 2 (first survey page):

sub btnNext_click(...)
dim frm3Child as new Form 3
frm3child.mdiparent = mainform /// this is referenced in a shared module
frm3child.show()
me.hide()
end sub

Form 3 (second survey page)
///this is where I'm having trouble. allowing the user to go back
sub btnBack_click(...)
???????????
end sub

I've tried numerous things, but I keep getting errors. I'm lost at this
point. Thanks for all responses.
Nov 21 '05 #1
1 898
Nak
Hi Martin,
I'm developing a survey program. Currently, I have the parent form and
the
survey which consists of three forms. As the user moves from one "page"
or
form to the next, I would like to allow the user to go back and correct
any
entries. Ideally, I would like to just hide one form as the user moves on
to the next, then show it if they decide to go back. But the problem I am
having is referencing the hidden form.


In order to access a specific instance of an object in .NET you need a
reference to it. You can either create your own global object reference to
store the instance or alternatively use the MDI parents internal array
"MdiChildren" which stores all of the references to it's children.

If you are only ever using 1 instance of the form at a time I would
suggest using a global object reference (either in a module or a utility
class),

-- in a module

Public frm2Child as form2
Public frm3Child as form3

--

sub mmuStart_click(...)
if(not (frm2Child is nothing)) then
frm2Child = new form2
frm2Child .mdiparent = me
end if
frm2child.show()
mmuStart.enabled = false
end sub

sub btnNext_click(...)
if(not (frm2Child is nothing)) then
frm3Child = new Form3
frm3child.mdiparent = mainform /// this is referenced in a shared
module
end if
frm3child.show()
me.hide()
end sub

sub btnBack_click(...)
me.hide()
frm2Child.show
end sub

It's all untested code but I think you got the idea anyway by storing
mainform in a module. Anyway, let me know if you have any problems and I'll
show you an example. Alternatively you could download an application of
mine that uses a wizard interface,

http://www.npsoftware.co.uk/freeapps.php

Either

WTR - Web The Ripper 2

or

FishNET

both of which use wizard interfaces but FishNET is allot smaller and
probably slightly easier to read. Anyway, it's a good idea to use
interfaces for this kind of thing (presumably that is what you are trying to
achieve). Take care.

Nick.
Nov 21 '05 #2

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

Similar topics

5
1418
by: Charles A. Lackman | last post by:
I am working on a application that has many custom made dlls. Actually, for this app each dll is a different form. I am able, with no problem to reference and instantiate them to use their public properties and methods with no problem. But, if one dll is trying to access another dll's properties (this does not work very good) the project...
3
3833
by: Diana Gard | last post by:
Perhaps this is a design flaw, please let me know. I'm using Access 2000. I have a form with a tab control and 5 subforms within those tabs. The forms match with the tables: Client main, Intake, Financial, Fees, Payments, Bills, Bill Line Items. The design works thusly - Client Main relates to Intake. Intake relates to financial....
1
1596
by: tdmailbox | last post by:
I have added search buttons to some access fomms. I have a seach button in both the parent and the child form. My issue is that when I search for a last name in the last_name field of the child form I want to search for that last_name accross all parent forms, flipping to any parent form that has a child record with the right last_name. ...
0
1295
by: Bisbal | last post by:
Hi All, I have created a class that simulates a MDI form by putting the 'child' inside a panel located in the 'parent' form. I had to do this because we use a custom UI that doesn't work properly with standard MDI forms. The constructor of the class is something like SemiMDI(System.Windows.Forms.Form client,System.Windows.Forms.Panel...
26
1917
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: FormChildA btn click can only open one instance for FormChildB. I need multiple instances of FormChildB. Any suggestions or ideas please.
7
3086
by: Siv | last post by:
Hi, I have an MDI application that uses a generic "ShowPage" routine in a module that is called when I want to display a child form. The basic idea is that in the module I have declared each form as follows: Friend F0 As frmMain Friend F1 As frmStart Friend F2 As frmSearch Then in my ShowPage routine (which is passed a string "pageToShow"...
1
3449
by: Vivek | last post by:
Hi, I am developing a MDI application. I need to track the child forms open so that I can stop a user from opening the multiple instances of the same child form. Now what is the best way of achieving it. I tried using an Forms Array but is not the most efficient way. I think I can create a collection but then how do I create a global...
2
4895
by: Mario | last post by:
Hi, I am trying to create an application with multiple windows forms. The problem that I have is that after creating the window forms, I do not know how to open formN after closing Main form. Each form is in its own class. What I want to do is the following: 1. Click a button on Main menu. 2. Close main menu ( I would use hide if...
6
1706
by: Kevin | last post by:
I've got an mdiParent form. I open an instance of a child form like this: Dim frmChild as New frmCustomers frmChild.Show() I've got a few of these open at a time. On each frmChild I open another form that displays customer data. When I make changes and save the customer data, I need the updated data to show on the correct frmChild. How...
11
12785
by: Tony K | last post by:
I have a MDI application. On the menu toolstrip child forms are selected from one of the menus. I don't want to play the disable/enable menu item game. I have selected that open forms are added to the "Window" menu item. What I'm looking for is when the user clicks on the menu item to open the form, how can I check to see if it's open...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.