Solved

Converting a program into a reusable class

Posted on 2008-06-25
7
165 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

 

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

Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

Question has a verified solution.

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

Suggested Solutions

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

738 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