Solved

Best way to pass data from project to project?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now