Um... My controls have disappeared?!

Reapz

Well-known member
Joined
Dec 15, 2002
Messages
74
I started a VB.NET project a while ago and had got quite far into it. Ive recently reinstalled my system and yesterday I got around to reinstalling VS.NET. The project was saved into My Documents as per default which is located on a backup drive.

When I opened the project and opened up the 2 main forms I found that all the code was intact, one of the forms was intact but the controls on the other form have disappeared. Im sure I have installed and referenced all ActiveX controls that I was using before.

I hope one of you guys has a solution because the form is quite complex and it will take bloody ages to replace all the controls.

Thanks in advance...
 
Oh and incidentally, there are no error messages or any indication of what the problem is and also I have tried to replace a couple of the controls and it wont let me because they already exist. I just cant see them!!!
 
Last edited by a moderator:
Look at the form that works.

Look ar the generated code.

There youll have:

Declaration of the controls
Instantiation (New() ...) of the controls
Initial setting of controls properties (Name. Location etc....)
Adding of controls to containers (pnlMainPanel.AddRange ....)


Now look at the form where the controls have disappeared and try to figure out what is missing.

My two guesses are ...
a) either negative values in the "location property"
or
b) they are no longer added to their respective containers.



Things arent that difficult.
 
RE-BUILD a few times worked for me

Oh and once thats done close .NET then reopen your project should work
 
This has been covered a few times - maybe we should add it to a FAQ (when we get one).

Check out your InitializeComponent function. Look at the VERY bottom where it sets properties for the form. Its probably missing the line:
this.Controls.AddRange(...)

If it is, its probably missing a bunch of other lines as well. Sometimes .NET (maybe with SourceSafe, maybe not) just deletes those lines. Ive seen it happen on a number of machines but never reproducable. Check source safe if you have it, otherwise youll have to manually add the controls back to the forms collection.

-Ner
 
Yea youre right it does appear to be missing that line. Ill see what I can do with it cheers.
 
Back
Top