Solved

Converting a program into a reusable class

Posted on 2008-06-25
7
163 Views
Last Modified: 2013-11-26
I have a project which consists of a form into which an invoice number is entered. This invoice number is then passed to a module which in turn calls a report which prints the invoice.

I am trying to develop some method by which I can pass the invoice number from any project and produce a report. Ideally the "method" will be some stand-alone class which I can then add to any project and get the functionality. To start with I would like to change my current project to call this new entity to prove that it works.

Any suggestions anyone?
0
Comment
Question by:grwallace
  • 4
  • 3
7 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21866676
It sounds like you need to create a DLL project, with a reusable class that has a method that takes the arguments that you need.  Are you saying that you don't have any experience creating DLL projects and classes?
0
 

Author Comment

by:grwallace
ID: 21866827
The answer to that has to be Yes, as I had no idea that this is what needed to be done.
How would I go about doing this in VB.Net 2008?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21866892
SWAG:

1) Create a DLL project
2) Add a class to the project
3) Add method to the class
4) Take the code from the form, and put into the method.

The specific steps are dependent on what you are really trying to accomplish.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

Author Comment

by:grwallace
ID: 21866964
In  the VB6 days I simply held the .bas in the programs folder and added it to the differenct projects along with the report.

This approach would be OK if I could do it here, but I can't add the report.
Is it possible to change the module - which callse the report - to a class and reference it from other projects? if this was the case then it might be simpler. Otherwise I will have a go with the DLL idea

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 21868132
You could do the same thing with VB.NET that you could with VB6.
0
 

Author Comment

by:grwallace
ID: 21882001
I have spent some time looking at this. I can indeed add the reports to a different project, but this would appear to make a copy, which means multiple version which is completly undesirable.

If i try to add as link then it adds the report but not the designer and the system doesn;'t work.

I would now like to try the DLL option mentioned earlier.
Currently the form consistes only the following code:-
 Private Sub Button1_Click(etc etc)
        BlUdt.Blinvoice.ThisBlmasId = 36833
        BlUdt.Blinvoice.ThisBlinvId = 32276
        Dim bilprt As New BilPrt
        bilprt.Do_Printout()
end sub
Bludt is a structure

I would now like to convert the BilPrt class into a dll and call it from the form. How do I go ablut this?
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 21887573
<P>>>I can indeed add the reports to a different project, but this would appear to make a copy</P><P>If you dragged and dropped the reports from one project to another, then it will make a copy, unless you hold down the shift key when you drag and drop.</P>
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

809 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