473,396 Members | 2,082 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,396 software developers and data experts.

Dynamic forms

guy
Has anyone any experience of building a form at run time?
I have an app that will require 50+ simple forms, it will only be used by
me, so appearance isnt important.

My idea is to pass a business object to a standard form and use reflexion to
determine what controls are needed, maybe using custom attributes to help
this.

any thoughts?

cheers

guy
Jul 21 '05 #1
13 1251
Guy,

You are always building a form at run time in dotNet..
Most often you use an inherited form that is inherited from
system.control.forms.form, however it is build at run time.

The form you build can always be used because it is a class by the wat

In VBNet
dim frm1 as new myform
dim frm2 as new myform
etc.

In C#
myform frm1 = new myform();
etc.

I hope this helps?

Cor
Jul 21 '05 #2
guy
Hi Cor yes i realise this:-)

what i intend is to pass a form an object, and have the form use reflexiton
to determine what controls are needed , thjat way i can have one form and use
it for working with multiple business objects

cheers

guy

"Cor Ligthert" wrote:
Guy,

You are always building a form at run time in dotNet..
Most often you use an inherited form that is inherited from
system.control.forms.form, however it is build at run time.

The form you build can always be used because it is a class by the wat

In VBNet
dim frm1 as new myform
dim frm2 as new myform
etc.

In C#
myform frm1 = new myform();
etc.

I hope this helps?

Cor

Jul 21 '05 #3
Guy,

I do not understand you, when you know what controls are needed you can just
add them to the form.

What reflection you need for that from the form class?

Cor
Jul 21 '05 #4
There is a region in all .net forms created with VS.net that is labeled:

"Windows Form Designer generated code"

I would suggest you create a new form expand this section and look at how
the controls are created. Then mimic this in creating your check boxes,
Group Boxes, TextBoxes, etc...

Each control created gets added to a controls collection, if you always want
to start with a blank form for the new business object you can just call
controls.clear(); Otherwise I would suggest that you create your own
collection that will hold Objects and when you need to clear the form you
spin through your collection and call controls.remove(current object);

Hope this helps.
--
Thanks
Wayne Sepega
Jacksonville, Fl
"When a man sits with a pretty girl for an hour, it seems like a minute. But
let him sit on a hot stove for a minute and it's longer than any hour.
That's relativity." - Albert Einstein

"guy" <gu*@discussions.microsoft.com> wrote in message
news:81**********************************@microsof t.com...
Hi Cor yes i realise this:-)

what i intend is to pass a form an object, and have the form use reflexiton to determine what controls are needed , thjat way i can have one form and use it for working with multiple business objects

cheers

guy

"Cor Ligthert" wrote:
Guy,

You are always building a form at run time in dotNet..
Most often you use an inherited form that is inherited from
system.control.forms.form, however it is build at run time.

The form you build can always be used because it is a class by the wat

In VBNet
dim frm1 as new myform
dim frm2 as new myform
etc.

In C#
myform frm1 = new myform();
etc.

I hope this helps?

Cor

Jul 21 '05 #5
guy
Cor,Wayne,
I am obviously not making myself clear:-)
what I intend (and the prototype works)
is to instantiate one form, pass it a business object, and have the form
decide what controls are needed.
so, if I pass it a BO with properties ID and Name it gives me the
appropriate labels and text boxes,
however if I pass It a BO with properties ID, Invoice Value, CstomerName and
Product Code it again displays the appropriate lables and text boxes.
I ave got this far and it works
I am now looking at using custom attributes to enhance the form.
The overall idea is to only have to code up openform, and have all the
simple BOs in the app use it.
(this is a part time app, and i have only about 3 hours a week to work on
it! - and its got 50+BOs so I dont want to code up 50+ forms!)

yes , im a lazy bu***r but coding individual Winforms is sooo boring - been
doing it since VS.net beta one

guy

"Cor Ligthert" wrote:
Guy,

I do not understand you, when you know what controls are needed you can just
add them to the form.

What reflection you need for that from the form class?

Cor

Jul 21 '05 #6
Guy,

We try to tell you to take a simple approach first, to do it difficult can
every fool the chalange is to do it easy and therefore very well
maintanable.
however if I pass It a BO with properties ID, Invoice Value, CstomerName
and
Product Code it again displays the appropriate lables and text boxes.


It is not possible that you can do it like this

We take your problem above, this means that you have lets assume that you
use labels and textboxes for that

5 labels with in the label.text the names ID, Invoice, Value, CstomerName,
Product Code
5 textboxes which have the tage ID, Invoice, etc

Those you can build dynamicly (in VBNet dim txt(0) textbox : txt(0) = new
textbox) and add them too the form and set the handlers using addhandler.

You can probably use than a for each routine to bind your properties from
the business object to the textboxes depending on their TagName.

What do I miss in this?

Cor

Jul 21 '05 #7
guy


"Cor Ligthert" wrote:
Guy,

We try to tell you to take a simple approach first, to do it difficult can
every fool the chalange is to do it easy and therefore very well
maintanable.
however if I pass It a BO with properties ID, Invoice Value, CstomerName
and
Product Code it again displays the appropriate lables and text boxes.
It is not possible that you can do it like this

*** It is possible, I have done it, it works :-) - i will post the code
tomorrow ***
We take your problem above, this means that you have lets assume that you
use labels and textboxes for that

5 labels with in the label.text the names ID, Invoice, Value, CstomerName,
Product Code
5 textboxes which have the tage ID, Invoice, etc

Those you can build dynamicly (in VBNet dim txt(0) textbox : txt(0) = new
textbox) and add them too the form and set the handlers using addhandler.

You can probably use than a for each routine to bind your properties from
the business object to the textboxes depending on their TagName.

What do I miss in this?
I will post the code tomorrow when I have tidied it up :-)

guy
Cor

Jul 21 '05 #8
Think I understand a bit more now, you have it creating the forms and doing
the lay out already, but what you are wanting to do is use custom attributes
to decide what Control to create? and maybe where to place it?

Wayne

"guy" <gu*@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...


"Cor Ligthert" wrote:
Guy,

We try to tell you to take a simple approach first, to do it difficult can every fool the chalange is to do it easy and therefore very well
maintanable.
however if I pass It a BO with properties ID, Invoice Value, CstomerName and
Product Code it again displays the appropriate lables and text boxes.


It is not possible that you can do it like this

*** It is possible, I have done it, it works :-) - i will post the code
tomorrow ***

We take your problem above, this means that you have lets assume that you use labels and textboxes for that

5 labels with in the label.text the names ID, Invoice, Value, CstomerName, Product Code
5 textboxes which have the tage ID, Invoice, etc

Those you can build dynamicly (in VBNet dim txt(0) textbox : txt(0) = new textbox) and add them too the form and set the handlers using addhandler.
You can probably use than a for each routine to bind your properties from the business object to the textboxes depending on their TagName.

What do I miss in this?

I will post the code tomorrow when I have tidied it up :-)

guy
Cor

Jul 21 '05 #9
guy
hi Wayne,
exactly:-)
my question wasnt so much 'how do i do this?' rather 'has anyone else done
this?'
as I have a prototype working ok
I am just interested in wether anyone else has tried this approach
sorry i didnt make this clear

cheers

guy

"Wayne" wrote:
Think I understand a bit more now, you have it creating the forms and doing
the lay out already, but what you are wanting to do is use custom attributes
to decide what Control to create? and maybe where to place it?

Wayne

"guy" <gu*@discussions.microsoft.com> wrote in message
news:76**********************************@microsof t.com...


"Cor Ligthert" wrote:
Guy,

We try to tell you to take a simple approach first, to do it difficult can every fool the chalange is to do it easy and therefore very well
maintanable.

> however if I pass It a BO with properties ID, Invoice Value, CstomerName > and
> Product Code it again displays the appropriate lables and text boxes.

It is not possible that you can do it like this

*** It is possible, I have done it, it works :-) - i will post the code
tomorrow ***

We take your problem above, this means that you have lets assume that you use labels and textboxes for that

5 labels with in the label.text the names ID, Invoice, Value, CstomerName, Product Code
5 textboxes which have the tage ID, Invoice, etc

Those you can build dynamicly (in VBNet dim txt(0) textbox : txt(0) = new textbox) and add them too the form and set the handlers using addhandler.
You can probably use than a for each routine to bind your properties from the business object to the textboxes depending on their TagName.

What do I miss in this?

I will post the code tomorrow when I have tidied it up :-)

guy
Cor


Jul 21 '05 #10
Guy,
I am just interested in wether anyone else has tried this approach
sorry i didnt make this clear


I have seen a lot in the language.vb group who started your approach.

It looks a little bit as trying to reinvent or create an own MS-access.

However although you have the advantage that you have not to be compatible
with all older MS-access versions, will it be a hard way to go, for that
your clients are statisfied. Don't become sad when they everytime ask you
why they cannot do what is done with Ms-Access so easy with your program.

Just my thought,

Cor
Jul 21 '05 #11
guy
Hi Cor, Its actually using a SQL Server backend. I will ***defintiely*** be
the only user of the system so the fact that it is not pretty is ok.

cheers

guy

"Cor Ligthert" wrote:
Guy,
I am just interested in wether anyone else has tried this approach
sorry i didnt make this clear


I have seen a lot in the language.vb group who started your approach.

It looks a little bit as trying to reinvent or create an own MS-access.

However although you have the advantage that you have not to be compatible
with all older MS-access versions, will it be a hard way to go, for that
your clients are statisfied. Don't become sad when they everytime ask you
why they cannot do what is done with Ms-Access so easy with your program.

Just my thought,

Cor

Jul 21 '05 #12
Guy,

I mean a MS Access application, not the database, AFAIK can MS Access as
well use a SQL server as backend.

However when it is for yourself, than it can be a greath project for at
least learing a lot.

:-)

Cor
Jul 21 '05 #13
guy
Exactly:-)

"Cor Ligthert" wrote:
Guy,

I mean a MS Access application, not the database, AFAIK can MS Access as
well use a SQL server as backend.

However when it is for yourself, than it can be a greath project for at
least learing a lot.

:-)

Cor

Jul 21 '05 #14

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

Similar topics

7
by: Bil Muh | last post by:
Esteemede Developers, I would like to Thank All of You in advance for your sincere guidances. I am developing a software using Visual C++ .NET Standard Edition with Windows Form (.NET)...
1
by: Nathan Bloomfield | last post by:
Does anyone know if there is any documentation which relates to Access2k + ? or can anyone help adjust the code? I am having trouble converting the DAO references. TITLE :INF: How to...
1
by: mtech1 | last post by:
Access 2002 I am trying to create a dynamic crosstab report that parameters come from 3 different forms. I get runtime error 3070 - The Microsoft Jet database engine does not recognize...
3
by: MikeY | last post by:
Hi Everyone, I am working in C#, windows forms.My question is this. All my button dynamic controls properties are present and accounted for except for the"FlatStyle" properties. I can't seem to...
7
by: AdeelAlvi | last post by:
iam working on a project called service desk that automates the departmental services online .one major component i have to create is that to convert paper based forms into dynamic webforms . i...
2
by: deejayquai | last post by:
Hi I'm trying to produce a report based on a dynamic crosstab. Ultimately i'd like the report to actually become a sub report within a student end of year record of achievement. The dynamic...
3
by: RahimAsif | last post by:
I am writing an application that requires the a portion of the main menu to be dynamic. The menu has file, panels, view files and help across the top. The view files sub menu needs to be...
5
by: matt | last post by:
hello, i am on an interesting project. in this project, i have to create dynamic data-entry forms for offline-users to fill out, save locally, and eventually postback to our app (when back...
0
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only,...
2
by: yomadhu | last post by:
I created a dynamic form in javascript. Am unable to get those values in to php to display. I need all details. If i add 10 rows the i need to display those all values. Can any one help me for that...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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,...

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.