Accessing Class data from different Layers?

I have created a Class in which it contains a bunch of Properties. In the UI of my app, I load a bunch of form values into this Classes properties. Now, what I want to do is pass this entire Class over to my Business and Data Layers. See below for what I want to do!

    'Form Class Call

    Dim clsRCD As New clsRefCellDisp

        Private Sub AddUpdateRefCellDispEquipment()
        Try
            Dim strIOType As String = ""
 
            clsRCD.CellDispName = txtCDDisplayName.Text
            clsRCD.Capacity = txtCDCapacity.Text
            clsRCD.LoadCellModel = txtCDLoadCellModel.Text
            clsRCD.LoadCellSN = txtCDLoadCellSerialNO.Text
            clsRCD.CellUncerntainty = CDec(txtCDCellUncertainty.Text)
            clsRCD.DisplayModel = txtCDDisplayModel.Text
            clsRCD.DisplaySN = txtCDDisplaySerialNO.Text
            clsRCD.DispUncertainty = CDec(txtCDDisplayUncertainty.Text)
            clsRCD.CDUncertainty = CDec(txtCDCDUncertainty.Text)
            clsRCD.NIST = txtCDNIST.Text
            clsRCD.CalDate = dtCalDate.Value
            clsRCD.Interval = CInt(cmbInterval.Text)
            clsRCD.NextCalibration = dtNextCalDate.Value
            clsRCD.TechID = txtCDTechID.Text
            clsRCD.Newest = CInt(txtCDNewest.Text)

            strIOType = BL.AddUpdateRefCellDisp(clsRCD)          <--- Line in question

        Catch ex As Exception
            strErr = gfrmID & "/AddUpdateRefCellDispEquipment() - " & ex.Message
            MessageBox.Show(strErr, "User Notification", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
    End Sub



For the line in question, I tried to create this function in my Business Layer where in the Function signature I tried to define a Class object but it would not let me. See below.

        Public Function AddUpdateRefCellDisp(ByVal cls As Object) As Boolean

        End Function


I want to replace "Object" above with "Class". Apparently it's not possible. So how do I reference my class that I instantiated in my Form Class?
BlakeMcKennaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Carl TawnSystems and Integration DeveloperCommented:
Your Business layer needs to reference the assembly that contains the definition of your class. I'm guessing they are not currently in the same assembly?
BlakeMcKennaAuthor Commented:
How do I do that? Is that the same as declaring an instance of that class within each layer, i.e.

    Private clsRCD As New clsRefCellDisp
Carl TawnSystems and Integration DeveloperCommented:
How is your project structured? Is your business layer in a separate project from your application?

You business layer won't know what a clsRefCellDisp object is unless it exists in the same project, or it references the assembly where the class is defined.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

BlakeMcKennaAuthor Commented:
The Business Layer is a separate project within my solution. The Class is within the Main project.
Carl TawnSystems and Integration DeveloperCommented:
If the class needs to be shared by both projects then you would be better off either putting it in the Business layer project itself, or moving it into a separate class library project and referencing that project from the business layer and your main project.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BlakeMcKennaAuthor Commented:
Well, I actually put it into the Business Layer project as a Reference...but what I'm not sure is, how do I pass the Class Property values into the Business Layer now that the Class is part of the Project.
Screenshot.jpg
Carl TawnSystems and Integration DeveloperCommented:
The type for your custom object is "clsRefCellDisp", so that is what you would specify as the type for the parameter in your BL. Like:
Public Function AddUpdateRefCellDisp(ByVal cls As clsRefCellDisp) As Boolean

End Function

Open in new window


As long as both your main project and the BL can see the definition of that class, then you should be set.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.