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 13 1235
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
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
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
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
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
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
"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
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
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
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
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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)...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM)
The start time is equivalent to 19:00 (7PM) in Central...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: Teri B |
last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course.
0ne-to-many. One course many roles.
Then I created a report based on the Course form and...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
|
by: GKJR |
last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...
| |