Results 1 to 4 of 4

Thread: help me create a simple class

  1. #1

    Thread Starter
    Member
    Join Date
    Apr 2004
    Posts
    59

    help me create a simple class

    hi

    can someone please help me out

    for now all i want to do is create an external dll file which is compiled using vbc. i know how to compile a .vb file

    once its compiled i want to use it inside my aspx code something like this

    textbox1.text = MyClass.Connection(1)

    this should insert the following text in the textbox1: "hello"

    and if i type

    textbox1.text = MyClass.Connection(2)

    it should give "bye" in the textbox instead!

    please help!

  2. #2
    Frenzied Member
    Join Date
    Mar 2004
    Location
    Orlando, FL
    Posts
    1,618

    Re: help me create a simple class

    Create a New Project and under Visual Basic Projects, chose a Class Library (this will create a DLL). To reference it in your ASP.NET app, add a reference to the DLL (over there on the right, right click reference, select add reference, and browse to it).
    Sean

    Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.

  3. #3

    Thread Starter
    Member
    Join Date
    Apr 2004
    Posts
    59

    Re: help me create a simple class

    thanks

    but that do i type in this class do make it do what i want it to do?

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: help me create a simple class

    In your class called MyClass, create a function which returns a string.

    VB Code:
    1. Public Function Connection(ByVal Switch As Integer) As String
    2.         Select Case Switch
    3.             Case 1
    4.                 Return "Hello"
    5.             Case 2
    6.                 Return "World!"
    7.             Case 3
    8.                 Return "Mendhak"
    9.             Case Else
    10.                 Return "unknown"
    11.         End Select
    12.     End Function

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width