Solved

Subforms in C#

Posted on 2014-01-01
11
848 Views
Last Modified: 2014-02-09
I have a form which was built using MS Access. It contains continuous subforms. Is there anyway in C# to have subforms in a form in the way you can with MS Access?
0
Comment
Question by:Idarac
  • 5
  • 5
11 Comments
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39749887
Hi Idarac;

If you are asking if a Form can crate another Form which can also crete another Form then the answer is yes, all you beed to do is design it that way.
0
 
LVL 1

Author Comment

by:Idarac
ID: 39749889
OK do you know how to insert (embed) a subform into a form?
0
 
LVL 84
ID: 39749892
However, you cannot "embed" a form in another in C#, at least to my knowledge, the way you can with Access. You could create a "main form" that shows your main records, and a second form that shows the "child" records, and then position the child form on the main form.

But this is something you'd have to handle, of course. Access does this for you, but C# will not.

Or you could use a grid control on the C# form to emulate the child records for the main form.
0
 
LVL 1

Author Comment

by:Idarac
ID: 39749915
Hi Scott that sounds like a plan.

Can you point me to an example of how to emulate using the grid control?
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39749935
Hi Idarac;

Yes you can embed a Form in a Form in a Form.  A Form is just like any other control with extra responsibilities. Here is a screen shot of a Form3 embedded into Form2 which is embedded into Form1 and all controls on all forms work.

A Form embedded into another Form
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39749940
Hi Idarac;

Of course if you're design goals is to display Data from a database such as Access you can use controls from the C# Toolbox to create a master detail view of the data without embedding a Form into another Form. Tell us what you need to do.
0
 
LVL 62

Expert Comment

by:Fernando Soto
ID: 39749966
Hi Idarac;

Here is an example of building a master detail DataGridView using an Access 2007 database.

Basics of manually creating a Master-Detail view of a backend database
0
 
LVL 1

Author Comment

by:Idarac
ID: 39750003
Fernando

Here is a screenshot of the form I am trying to build.

-I
AreasExample.png
0
 
LVL 1

Author Comment

by:Idarac
ID: 39750011
In Access it is called continuous a subform.
0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 500 total points
ID: 39750054
In C# what you are asking is called a UserControl or also called a Composite control. A user control is a control that has one or more controls laid out in a container. For example it could have TextBox, CheckBox, ComboBox, Label controls in a layout of your design. When this control is compiled it gets placed in the Toolbox of the designer, at this point the control can be added to your project form or added programmatically in code. To make it look more like Access you can add the control to a FlowLayoutPanel. See the following article Walkthrough: Authoring a Composite Control with Visual C# for how to create UserControl/Composite control.
0
 
LVL 1

Author Closing Comment

by:Idarac
ID: 39845921
Worked great sorry for my slow response.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now