winforms design suggestions / help

  • Thread starter Thread starter GiJeet
  • Start date Start date
G

GiJeet

Hello, I'm working on a winforms app that will be used in stores in
different states and each state can have different data capture
requirements. I want to create a base form for for all the common
data and wish to use visual inheritance to subclass the different
forms that need to capture specific data for each state - but I don't
want to have 50 different subclasses. And I don't want to have a huge
IF statement saying IF NY activate this field, IF FL activate that
field, etc.

Any suggestions on the best way to go about doing this would be
appreciated.

TIA
G
 
You need to do some analysis on the needs and find the common points. You
will likely find you can work either with a few subclasses, as states group,
or with groups of classes attached to the main class.

If your business does not give time for analysis, you can start with 50
classes and refactor down. If you business will not give time for
refactoring, you are in trouble.

As for the UI, you can create a more dynamic UI that reads the classes, so
you do not need 50 UIs.

BTW, this is always a pain.

The other method is to set up custom fields that can store any old crap you
want. This is common with configurable systems. I would rather do the
analysis and add a few custom fields for the business than adopt this
methodology.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
 
As for the UI, you can create a more dynamic UI that reads the classes, so
you do not need 50 UIs.

Cowboy, when you say "dynamic UI" do you mean build the form on the
fly at runtime?
 
I think that's what he was meaning. And I think it's a good approach
for the kind of problem you're speaking.
You can base your code on small user controls, each one doing a
specific data capture. The form is built at runtime using those
controls. The form layout can be stored in an xml file, each user
having its own one.

Seems like a good idea but maybe a little too advanced for me. Is
there any code or examples anywhere that I can read and follow?

TIA
G
 
I do not know if there's a full tutor on this subject on the web, you
can try google of course.
But this is not very difficult. In VS it is very simple to build a user
control, so just try to build one to understand the process (and you'll
find a lot of tutors about building user controls on the web).
Once you know how to write a UC, you can write tons of them..
Then, it is not very difficult to read an XML file containing a form
layout, each entry will have the class name of the control and the X,Y
position. A simple loop that creates each UC on the fly will make the
job.
Of course, all depends on your skill. As we can't write the code for
you, the best is trying to write it by yourself and come here again and
again if needed with some precise questions and will try to help each
time...

OD, I don't think I'd have trouble with the code itself, just trying
to get the whole concept in my head. So, you use a User Control that
contains code that reads an xml file that describes the form layout?
I guess I'm not following how that works. Is there a name to this
concept that I can google? Or better yet, if you could send me a few
links to follow that would be great. Thanks!!
G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top