CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: User Controls

  1. #1
    Join Date
    Aug 2009

    User Controls


    I wanted to create a custom control in Visual Studio, and then add it as a component to a form. So, I added a new "User Control" to the project, and edited it by dragging and dropping buttons, labels etc. Then, I want to be able to add this control to a form.

    I've been told that I needed to build the project, and then add the .dll for the control to the toolbox items. So, I built the project, and then did Tools->Choose Toolbox Items. Here, I browsed through my project directory, and found the .exe for the project, which was found in MyProject\Debug. After this, my user control appeared in the list of toolbox items, with a gear wheel symbol next to it.

    So, I then dragged this user control into my Windows form, but the control does not actually appear on the form. It doesn't give me any errors when I drag and drop, but the control is not added to the window, and does not appear in the source code for the form.

    So I have done something wrong....one thing I notice is that I added the .exe for the project (MyProject\Debug\MyProject.exe) rather than a .dll for the user control, which is what I was looking for - but couldn't find one anywhere, despite having built the entire project.

    Any ideas?? Thanks!

  2. #2
    Join Date
    Sep 2009

    Re: User Controls

    1. file extension (.exe or .dll) does not metter.
    2. As far as I know VS will automatically add all controls you have for tool box after project/solution rebuild. To be able to use control form another project as it was defined simple reference adding and again rebuild should be enough. Your User controls will be in the 'Custom controls' section in the toolbox.

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.