Custom Controls: Import a custom namespace and use its functions within

Discussion in 'ASP .Net' started by user, Jul 18, 2007.

  1. user

    user Guest

    Hi,

    I've a custom control and here are it's contents:

    mypanel.asx

    --------------------------------------
    <%@ Import Namespace="mylib" %>
    <%@ Assembly Src="mylib.vb" %>
    <script language="VB" runat="server">
    Public strName as String
    mylib.mysub() 'This line will cause a compilation error:
    Declaration expected
    </script>

    --------------------------------------
    How do I call mysub() inside a custom control?

    Please advise!

    Thanks
    user, Jul 18, 2007
    #1
    1. Advertising

  2. You can't simply put executable code inside a class declaration, which is
    what a Control is (a class). Executable code must be in a property or a Sub
    or Function.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP

    Printing Components, Email Components,
    FTP Client Classes, Enhanced Data Controls, much more.
    DSI PrintManager, Miradyne Component Libraries:
    http://www.miradyne.net

    "user" <> wrote in message
    news:...
    > Hi,
    >
    > I've a custom control and here are it's contents:
    >
    > mypanel.asx
    >
    > --------------------------------------
    > <%@ Import Namespace="mylib" %>
    > <%@ Assembly Src="mylib.vb" %>
    > <script language="VB" runat="server">
    > Public strName as String
    > mylib.mysub() 'This line will cause a compilation error:
    > Declaration expected
    > </script>
    >
    > --------------------------------------
    > How do I call mysub() inside a custom control?
    >
    > Please advise!
    >
    > Thanks
    >
    Kevin Spencer, Jul 19, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Èý¹â
    Replies:
    1
    Views:
    555
    William F. Robertson, Jr.
    Jul 29, 2003
  2. Poor Yorick
    Replies:
    2
    Views:
    288
    Bruno Desthuilliers
    Jul 13, 2007
  3. thunk
    Replies:
    1
    Views:
    292
    thunk
    Mar 30, 2010
  4. thunk
    Replies:
    0
    Views:
    453
    thunk
    Apr 1, 2010
  5. thunk
    Replies:
    14
    Views:
    599
    thunk
    Apr 3, 2010
Loading...

Share This Page