Results 1 to 3 of 3

Thread: [RESOLVED] loading usercontrol based on conditions

  1. #1

    Thread Starter
    Lively Member {yak}'s Avatar
    Join Date
    Aug 2005
    Posts
    119

    Resolved [RESOLVED] loading usercontrol based on conditions

    Is there a way I can do some validation before loading a usercontrol? I have a usercontrol that I only want to load when certain conditions are met, any ideas?
    {yak}

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

    Re: loading usercontrol based on conditions

    Code:
    if (some condition)
    {
        MyUserControl uc = new MyUserControl();
    
        // Set properties of uc here, e.g. Location, Size, etc.
    
        this.Controls.Add(uc);
    }
    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

  3. #3

    Thread Starter
    Lively Member {yak}'s Avatar
    Join Date
    Aug 2005
    Posts
    119

    Re: loading usercontrol based on conditions

    Very cool, I didn't have this line:
    this.Controls.Add(uc);

    Thanks alot
    {yak}

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