If you want to create custom assemble, you need to have full version of Microsoft Visual Studio 2008. with Visual Basic.Net, Visual C/3, or other .net Languages templates installed.
Steps to manually create the Custom Assembly :
- Start Visual Studio and then create a New Project. Navigate to Visual Basic , Windows and then select the Class Library template, Give the name for the Project PrjCustomAssemblies.
- In the Solution Explorer, right click on the Class1.vb module and rename it CustomColor.vb. In the message box that appears, click Yes to also rename all references to Class1 in the code generated by Visual Studio.
- Add tow public functions to the class: one shares(shared is a visual basic keyword to create static members) and one instance based. The code should look like in the below model.
public class customcolor
public Shared function Getstockcolor( ByVal Stock as Short, ByVal Level as
Short) As String
Dim ReturnValue as StringRetunValue = " "Select Case (100 * stock)/ LevelCase Is < 80ReturnValue = "Red"Case Is <100Return Value = "Blue"Case Is >=100Return Value = "Green"End SelectReturn ReturnValueEnd function
public function Getstockcolor( ByVal Stock as Short, ByVal Level as
Short) As String
Dim ReturnValue as StringRetunValue = " "Select Case (100 * stock)/ LevelCase Is < 80ReturnValue = "Orange"Case Is <100Return Value = "Yellow"Case Is >=100Return Value = "Gold"End SelectReturn ReturnValueEnd function
- In the Solution Explorer, right click the project name, and then select properties. On the Application tab, which is selected by default when you open the project properties window, notice the root namespace PrjCustomAssemblies added automatically by Visual Studio. You need to know this namespace so that you can correctly refer to your functions in a report.
- On the Build menu, select Build Solution, Save the project, and then exit Visual Studio. Your custom assembly in now prepared for deployment.
No comments :
Post a Comment