Results 1 to 4 of 4

Thread: [02/03] How can I call a Usercontrole into my Form?

  1. #1

    Thread Starter
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    [02/03] How can I call a Usercontrole into my Form?

    Hi All,,

    Like the question said.

    I've created a UserControle and how can I showed up into a Form.

    Thanks in Advance,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

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

    Re: [02/03] How can I call a Usercontrole into my Form?

    A UserControl is a control like any other, so you show it on a form like any other. If you're talking about doing so at run time then, just like any other control, you have to pass it to the Controls.Add method of the intended parent control.
    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
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [02/03] How can I call a Usercontrole into my Form?

    Hi jm,

    Thanks for your reply.
    I created the Usercontrol with several radiobuttons during designtime ( UserControl1.vb) so it's nearly the same like a Form I thought, but it didn't worked that way to show it into the form1.

    I've tryed something like:

    VB Code:
    1. Dim UserControl1 As New UserControl
    2. UserControl1.Show()

    Is there a way to show it into my form1?

    Thanks,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

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

    Re: [02/03] How can I call a Usercontrole into my Form?

    A UserControl is a control like any other, so you show it on a form like any other. If you're talking about doing so at run time then, just like any other control, you have to pass it to the Controls.Add method of the intended parent control.
    VB Code:
    1. Dim UserControl1 As New UserControl
    2. Me.Controls.Add(UserControl1)
    The Show method simply sets the Visible property to True, which it is by default. If the control has not been added to a container then it doesn't matter what its Visible property is.
    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

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