?
Solved

Best way to pass data from project to project?

Posted on 2014-01-16
4
Medium Priority
?
194 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
  • 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

839 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