Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Converting a program into a reusable class

Posted on 2008-06-25
7
Medium Priority
?
172 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

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 1500 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Integration Management Part 2
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

972 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