• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 184
  • Last Modified:

Generic code for developing application

I have to develop a Application for  a enterprise. can anyone suggest how to make a foundation class / code to reduce the coding. i dont want to code for each form for navigation, save , delete etc. what should i use ado bound control form or  ado code form .
1 Solution
Check out the following framework: http://www.alstra.com/ .  I don't have any hands-on experience with the product. I'm just aware of it's existence.

I wouldn't suggest building your own. The reason is it's even harder and time consuming building a specific app since you need to write very generically. You'd spend more time building the framework then you could ever build the app. The payback would not be on the first app, or possibly even the 2nd. It would start to have a payback once the development/maintenance of apps recoupes the cost of the framework development.

Definately building your own class objects will be very usefull. At first it might take you time to build the structure behind it but in a long run it will help you to maintain it easier. If you going to create a class that would be responsible for moving your recordset and doing updates,editings,deletes go with the unbound mode. Say you have 2 tables in a database where you even just have to browse the data you will have to write the code 2 times or even if you do write it in functions it won't be as robust as the class object. Take a look at something like this
say this is cObjRs class
------Class cObjRs--------------
Public Sub Movenext(rs as AdoDB.Recordset)
if not rs.eof then
end if
end Sub

Public Sub MovePreviouse(rs as AdoDb.Recordset)
if not rs.bof then
end if
end Sub
this is very simple browsing example
--------End Class-----------------

--------Form Code-----------------

Public rs as ADODB.Recordset
some place in Form_Load event of the form delcare the instance of the cObjRs class.
Private table as cObjRs
now you can use that objects recordset browsing. Its pretty cool since now only you can browse the first table but also the other tabes as well.
--------END Form CODE-------------
if you declare 2 recordset they both can use your cObjRs class to browse the data pretty cool.
I think the question you are asking has to do with polymorhism and inheritance. You want to be able to write one "Save" routine for all saves. VB does not provide true inheritance. It provides what MS calls "implemented inheritance". It is well beyond the scope of this answer to explain inheritance. However, If you figure out what the "Implements" keyword in VB is all about you will in the process figure out what implemented inheritance is. I would suggest reading "Doing Objects in Visual Basic 6" as a start. By Deborah Kurata.

In a class module you would use the Implements keyword in the declarations section for an interface called "IInterface" as follows:

Implements IInterface

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now