Solved

what would an Expert do?

Posted on 2011-09-30
2
276 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

747 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

13 Experts available now in Live!

Get 1:1 Help Now