how to step thru code in usercontrol?

R

Rich P

I created a simple user conrol in a Windows User Control project, and it
uses a timer and colors some labels cyclily. I build the control. Then
I add a test winform project to my usercontrol project to test out the
control. Currently, I make a reference to the dll of the usercontrol in
the Test winform project, but this does not allow me to step through the
code of the user control.

How can I step through the code of my user control?

Thanks

Rich
 
P

Peter Duniho

Rich said:
I created a simple user conrol in a Windows User Control project, and it
uses a timer and colors some labels cyclily. I build the control. Then
I add a test winform project to my usercontrol project to test out the
control. Currently, I make a reference to the dll of the usercontrol in
the Test winform project, but this does not allow me to step through the
code of the user control.

How can I step through the code of my user control?

If you have the source code and are referencing a build of the
UserControl sub-class assembly that includes a PDB file that goes with
that source code, you should be able to step through the code without
any trouble.

If you don't meet those conditions, you need to fix your build settings
so that you do. If you can't meet those conditions, there's no way to
step through the source code of your UserControl sub-class.

Note that by default, all those conditions should be met already. It's
unusual to not be able to step through code that you've built and
referenced on your own computer.

Pete
 
C

CY

control.  Currently, I make a reference to the dll of the usercontrol in
the Test winform project, but this does not allow me to step through the
code of the user control.  
some snipping done

a ref to a dll with no source in the project might be a problem to
step trough, now saying that I never tested but had about the same/
well other problem with creating a service, some ugly tricks and it
could be done but...
The problem with the service was that it normally didnt run in the IDE
if I remeber correctly.
An easy way would be to take the code and run it not as a UC, debug
and then make the control.

Well midnight here now so, dont trust me.. but might be a thought..

//CY
 
R

Rich P

Thanks for the reply. Yes, I have the source code. I wrote it. Silly
me. Here is my big guffaw, the control was running in the test app
designer. I forgot to run the test app. Now it breaks in the source
code when I actually run the test app.

Lesson for today: can't break in usercontrol sourcecode if it is
running in the test app's designer. Have to actually run the test app.



Rich
 
J

Jeff Johnson

I created a simple user conrol in a Windows User Control project, and it
uses a timer and colors some labels cyclily. I build the control. Then
I add a test winform project to my usercontrol project to test out the
control. Currently, I make a reference to the dll of the usercontrol in
the Test winform project, but this does not allow me to step through the
code of the user control.

This is why I prefer project references to DLL references. I find debugging
much easier that way.
 
R

Rich P

Thanks. Yes, that did help. My problem was that I did start my
usercontrol project this way - first create the winform testor proj and
then the usercontrol. But I couldn't find the toolbox sections for the
testor control. Now after following the instructions at

http://msdn.microsoft.com/en-us/library/5ytx0z24.aspx

Now I am able to create my usercontrol project with the testing
environment correctly.

Thanks again, and thanks to all who replied to my post

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top