Results 1 to 5 of 5

Thread: [RESOLVED] [2005] Need to have a sub that expects a container

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Resolved [RESOLVED] [2005] Need to have a sub that expects a container

    How would I declare a sub to only allow container object to be passed to it? Is this possible?

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: [2005] Need to have a sub that expects a container

    Code:
    Private Sub MySub(ByVal pnl As Panel)
    
        End Sub
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [2005] Need to have a sub that expects a container

    Is it possible to make it so it accepts any type of container and not restrict it to just one specific, ie panel?

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Need to have a sub that expects a container

    What do you mean by a container? You simply declare your parameter as the most specific type that's common to all the objects you want to be able to accept. That might be ContainerControl, ScrollableControl, Control or something else. Simply look up the MSDN documentation for each type you want to support and you'll see their inheritance hierarchy.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2001
    Location
    Mass USA
    Posts
    1,674

    Re: [RESOLVED] [2005] Need to have a sub that expects a container

    thanks, using ContainerControl... monday morning > me

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