Solved

what would an Expert do?

Posted on 2011-09-30
2
283 Views
Last Modified: 2012-05-12
i'm writing a customer support app (vs 2010\vb.net\mysql) for my company. it's very straightforward, get customer details and populate a bunch of controls - txt fields, listboxes, etc. there's also a bunch of transactional functionality through buttons. never having written, or worked with, a customer support app before, i made the mistake of having the app work only with a single customer at a time. but now there's a need to work with more than one customer - identical data (but for diff customers), identical functionality.

my question is this: what is the best way to manage this kind of identical duplication of data\functionality? basically, i simply created a tab control and put all the original controls on tab page one, and then made a copy of them on tab page two and renamed them from txtCustomerName --> txtCustomerName2, txtCustomerID --> txtCustomerID2, etc. then, i just set a flag recording what tab page i'm on, and all the code behind behaves according to the flag. The problem with this is that i've basically doubled the amount of code i have,

if i'm on tab page 1 then

      do this

elseif i'm on tab page 2 then

      do this

end if

is there a better way to manage these types of more-or-less identical collections of controls\functionality? for example, i'd like to put even a couple more tab pages on my tab control and let them have 3 or 4 different customers open at the same time, but i'm sure i'm not handling this problem in the best way.

any advice is greatly appreciated...

TIA,

crafuse
0
Comment
Question by:crafuse
2 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 250 total points
ID: 36892669
I would rather go for a MDI (Multiple Documents Interface) type of interface. This is the same system used by Word and Excel so that you can open multiple document at the same time.

That would enable the user to see both customers at the same time on the screen. And as an extra, without doing any thing special, the user will be able to display as many customers as he wants. Another extra. Since you will be reusing multiple copies a the same form and each form is individual, you won't have to make the difference between TextBoxName1 on the first tab and TextBoxName2 on the second tab. Each form with handle itself from a shared code base.

Create a Form with the display you intended to put in a tab. This will create what we will refer to as a child form, so let's call it FormChild.

Create another form. That will be the MDI, so call let's call it FormMDI. In that form, set the IsMdiContainer property to True.

Add a button or a menu to FormMDI with the following code:
Dim frm As New FormChild
frm.MdiParent = Me
frm.Show()

Open in new window

Startup the application in FormMDI.

Each time the use activates the button or the menu, a new copy of FormChild will open inside of the MDIForm.

Have fun.
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 36892698
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

825 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