Solved

Best way to pass data from project to project?

Posted on 2014-01-16
4
190 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 500 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

718 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