Ok, so I am very very new to c#. In fact just trying my first application. I created a new application that has a form. I created a new class derived from UserControl. How do I add the new control to my form?
Probably very elementary question but I couldn't find the answer on google.
Compile the application. It should appear in the toolbox, then just drag and drop like any other...
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009,2010 In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Compile the application. It should appear in the toolbox, then just drag and drop like any other...
Hmmm, well I built and rebuilt the application, and I don't see anything. Class is named PlanView, so a control named PlankView should be in the toolbox?
Talikag brings up a good point. I was assuming that your UserControl was in the same solution as your form....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009,2010 In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Clean, Zip and Post your project is you are still having problems...
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009,2010 In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Clean, Zip and Post your project is you are still having problems...
Well, I must be doing something wrong or mis-understanding how to do it. Because I don't see any new "PlankView" control.
Thanks for you help, source is attached.
Steps I followed:
1) New Project
2) Renamed .cs file from Form1 to MainFrame.cs
3) Project/Add User Control
4) Specified "PlankView.cs" for name and selected "User Control" template.
5) Add OnPaint event handler for the control.
6) Compiled
Looked for a new control in the toolbox and nothing with the name PlankView.
Downloaded project, compiled, opened toolbox, and "PlankView" is shown under "BedPlan2k7 Components" in the toolbox, dragged it onto the form....
You MUST be missing something....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!) 2008, 2009,2010 In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
Downloaded project, compiled, opened toolbox, and "PlankView" is shown under "BedPlan2k7 Components" in the toolbox, dragged it onto the form....
You MUST be missing something....
LOL, I hate this, everytime I try something new..... I am using Visual Studio 2005 professional. I have closed and opened that project, I have compiled and recompiled that solution, and I don't get a "BedPlan2K7 Components" in my toolbox.
Did you open the "ToolBox" Window? If you didn't - do it, and drag the user controls & components to the form, if you did - just drag from the toolbox controls into the form. Or maybe the user controls doesn't appear there? Maybe you sould attach a printscreen. It might help.
Did you open the "ToolBox" Window? If you didn't - do it, and drag the user controls & components to the form, if you did - just drag from the toolbox controls into the form. Or maybe the user controls doesn't appear there? Maybe you sould attach a printscreen. It might help.
Yes, I have the toolbox open. I even went as far as opening and closing the toolbox several times. There is no "user controls and / or components" in my toolbox.
To tell you the truth, I was just doing this for learning purposes. I deleted the project, I will try again tomorrow and give you a print screen. I am confident it won't work then either.
Any luck with this? I have the exactly same problem. When I first setup the VS2005 I choosed C++ layout for menus and so on. Did you do the same?
Edit:
"Fix" found. Seems to be an error when you choose other profiles to work with (I used C++ style). Follow these steps to fix:
* Close the solution you have open
* Tools -> Import and export settings
* Select "Reset all settings" (Save your old settings if you like)
* Select "General Development settings"
Do the same all over again then select "Visual C# Development settings"
That worked for me, please let me know if it works for you to!
Last edited by Large; May 6th, 2007 at 01:14 PM.
Reason: New updates added!
==========================
Lars Werner aka Large http://lars.werner.no/
==========================
Look in the toolbox area again, and if you haven't done so expand the section labeled "All Windows Forms". Look on the bottom of that section for something that looks like a blue toothed gear. That may be your user control.
It seems to be a strange bug for me. Guess the IDE thingy ain't so great after all
==========================
Lars Werner aka Large http://lars.werner.no/
==========================
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.