Generic Input Screens

Alien777
06-09-2005, 10:05 AM
I am creating input screens for 4 different departments. For each department there is one input screen for each of the following: Output, labour, Line hours and input. But for each department each of these screens is populated differently and obviously the data has to be saved to the correct department.
Each screen has a grid and a save button.
How can I implement 4 different classes that hold all the information (sql strings, etc) for each department? I already have code that is starting to look very 'iffy' and unefficient, I need a class that can handle the verification and population of the respective departments.

Bolek
06-09-2005, 02:10 PM
I suggest making one form with all the functionality in it. You just create a private variable called "Department" and four functions called "ShowDepartment1", "ShowDepartment2" etc. like this


private department as long

public sub ShowDepartment1
department = 1
show me
end sub


Then you crreate four functions for storing the data entered in the form and choose which one to use in the OK button handler

private sub ProcessDepartment1
.....
end sub

private sub ProcessDepartment2
.....
end sub

....

private sub btnOK_Click
select case department
case 1: ProcessDepartment1
case 2: ProcessDepartment2
case 3: ProcessDepartment3
case 4: ProcessDepartment4
end select
end sub


This is the only way to do it without inheritance I can imagine.

Bolek
06-09-2005, 02:11 PM
PS: You then use

MyForm.ShowDepartment1


instead of

MyForm.Show

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum