?
Solved

Best way to pass data from project to project?

Posted on 2014-01-16
4
Medium Priority
?
193 Views
Last Modified: 2014-02-17
I have a solution in which I have built an Error Handling Project that consists of 1 class. I need to have every other Project including my main assembly be able to talk with this project...so, I declare a new instance of the Error Handling class in each Form and Project,

    Private EH As New ErrorHandling.ErrorHandler

Open in new window



however, in doing some testing, and I will use my DataLayer (a separate Project) as the example, I've noticed that whenever an exception occurs, I populate the EH.strRetVal (strRetVal is a public variable declared within my ErrorHandler) with the exception message but I don't pass it back because in the DataLayer, I'm passing back either a DataSet or DataTable. So in this case the exception goes unnoticed.

What I'm thinking is that if I change the signature of the function to return Object instead of DataSet/DataTable, how do I check the return value to see if it's an error message or a DataSet/DataTable?

Thanks!
0
Comment
Question by:BlakeMcKenna
[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
  • 3
4 Comments
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 39786110
You never use Object when you know what you need. Its prone to bugs, lowers performance, and requires casting for most uses.

Look at how the framework is built. It is always a good indication of what you should do. When an event or a method needs to return many values, they created a class with the necessary properties.

Simply create a small class that has a property for the DataSet/DataTable (which one?) and another for the message. Have the function return an object of this class, so both informations will be available.
0
 

Author Comment

by:BlakeMcKenna
ID: 39786133
What about just creating a DataSet/DataTable property and an Integer property in the ErrorHandling class?
0
 

Author Comment

by:BlakeMcKenna
ID: 39786184
I went ahead and added 3 properties to my ErrorHandling Class. But now, I'm not sure what my signature should look like in the called routine.
0
 

Author Closing Comment

by:BlakeMcKenna
ID: 39866211
Thanks James...that gave me some ideas!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

649 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