cdemott33
asked on
Best Pratice Newbie Question Regarding Custom Classes
I'm a newbie programmer so this might be a bit of a no-brainer for you experts, but I'm just looking for some guidence in regards to custom classes.
I created a class file called shipping.vb that lives in my App_Code folder
The Namespace in the shipping.vb file is called:
MyCompany.ProgramMnagement .DataLayer
I also have a public class within that namespace called 'shipping' and a function called 'InsertShippingRecord'.
In my code behind I do something like this to instantiate my class and use that function.
Dim myShippingClass As New MyCompany.ProgramManagemen t.DataLaye r.Shipping ()
I then write the following to utilize the InsertShippingRecord function of my shipping class:
Dim insertNewShippingRecord As Int32 = myShippingClass.InsertShip pingRecord ()
This all works perfectly. No problems.
My quesiton is... is this the best way to do it?
The other night I was thinking that maybe I could import the class, similar to the way I import System.Data.SqlClient at the top of my code behind page. It sounded like a good idea but I'm not sure.
Any feedback would be greatly appriciated.
I created a class file called shipping.vb that lives in my App_Code folder
The Namespace in the shipping.vb file is called:
MyCompany.ProgramMnagement
I also have a public class within that namespace called 'shipping' and a function called 'InsertShippingRecord'.
In my code behind I do something like this to instantiate my class and use that function.
Dim myShippingClass As New MyCompany.ProgramManagemen
I then write the following to utilize the InsertShippingRecord function of my shipping class:
Dim insertNewShippingRecord As Int32 = myShippingClass.InsertShip
This all works perfectly. No problems.
My quesiton is... is this the best way to do it?
The other night I was thinking that maybe I could import the class, similar to the way I import System.Data.SqlClient at the top of my code behind page. It sounded like a good idea but I'm not sure.
Any feedback would be greatly appriciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The second link was
http://msdn.microsoft.com/en-us/library/bb399567.aspx
http://msdn.microsoft.com/en-us/library/bb399567.aspx
http://msdn.microsoft.com/en-us/library/bb397897.aspx
http://msdn.microsoft.com/en-us/library/bb397897.aspx