Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

How to re-use code to manipulate headers and details in a base class that will be extended?

$
0
0

Hi,

I've created a form that handles the basic functionality of updating a header record, and adding/removing/updating detail records in a master-detail relationship.  I want to be able to re-use and extend this functionality in other forms that are based on the same master-detail relationship, but also extend it.

In this case, I have a basic Ticket - TicketLine relationship, where the Ticket has a Customer, a Store, and some other basic information, and the Ticket Lines contain SKU and Qty information.  I also have a Service Ticket as a subclass of Ticket, which stores some additional data on the header, and also adds some additional data to each line.  I would very much like to reuse the code I already have for adding/removing/updating the lines and saving the base data.

I am not really looking for code samples, although if that's the easiest way you can express your ideas, I will be able to understand them.

I'm really looking for general advice.  Should I subclass the Form?  Create User Controls?

My base Ticket form has several fields for the header information, and a DataGridView for the lines.  Ideally, my specialized forms would simply extend whatever was defined there, adding additional fields to the Header or additional columns to the Lines grid.



Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>