views:

87

answers:

2

This is in MSVC# 2008. I wrote a simple usercontrol that has 2 labels, 2 textboxes and 1 button. I also created a few properties for the user to set the labels' and the button's text.

I added this usercontrol to a form, compiled and ran it and it worked fine. Then today I went back and added another similar property. Now suddenly the new one wouldn't get recognized when I tried to set it. I was curious, so I tried to comment out one of the old properties, rebuilt everything again, and I still saw the supposedly "deleted" property showing up in the list.

What is going on? What must I do to get it to "update" when rebuilding doesn't? If you need to see the code please let me know.

EDIT: Thank you all for replying. I apologize for not having mentioned that they do have separate assemblies.

A: 

Sometimes VS gets a bit buggy with WinForm controls and my guess this is what happened to you. Try:

  1. Run clean on the solution, restart VS, build everything and see if it helped
  2. If not, close VS, delete the .suo file, start VS, clean, rebuild

Let me know if it doesn't help

Grzenio
A: 

If you have placed the User Control in separate assembly, then it looks like the project dependencies are not set up correctly (Solution, properties). Check the timestamp of the DLL in the FormsProject\bin\Debug folder.

If this happen in 1 Project, it is certainly strange. Normally a (Re)Build should be enough. Can you build w/o errors?

Henk Holterman
In fact I did place it in a separate assembly. I had thought about dependency, and I did try to set it up by going to Project -> Project Dependencies, and ticking the checkbox for the form (I guessed that meant the form is supposed to be dependent upon the usercontrol).I looked at the DLL and it had not been modified, so you might be onto it. How do I get the DLL to change?
Terry
At the very least, the ControlDll should hav CopyLocal set under the references node of the FormProject.
Henk Holterman
Continue: VS normally sets it up quite weel, just make a new Project+Library solution for references. Takes 1 minute.
Henk Holterman
Yes, it works when I create everything back up from scratch (aka a class library which I then added to the new form project, together with the dll to the reference). I'm only confused as to why it happened in the first place. The old project and the new one are exactly the same as far as I know. But then again, only as far as I know. :)Thank you all for your help.
Terry
I've finally realized that if I want to be 100% sure that the changes I made to the control are visible in the form, I must delete and re-add the dll to the reference. Otherwise, there is no guarantee.
Terry
@Terry: you shouldn't have to Re-Add the references. If you simply add both projects to the same Solution and add the reference using the Project Tabpage everything should function automatic.
Henk Holterman