Visual Studio not recognizing a VB form

  • Thread starter Thread starter Dave Taylor
  • Start date Start date
D

Dave Taylor

I have a VB.NET WinForms project that has about 15 forms in it. When I
opened the project yesterday, one of the form files does not open as a form
(i.e. double-clicking it in Solution Explorer opens up the code file, not
the form designer). Also, it does not appear to recognize the code
file....there are no outlining indicators, typing in the code file there is
no Intellisense stuff, and the code does not compile saying that it doesnt
recognize the form's class. The form was completed in July and hasnt been
edited since. I also tried replacing the form file (.vb and .resx) from a
backup and it still does not recognize the form. Could this be an issue in
the solution file? and is there a way to rebuild that or what?

Thanks for any help


Dave Taylor
PERI
 
Dave Taylor said:
I have a VB.NET WinForms project that has about 15 forms in it. When I
opened the project yesterday, one of the form files does not open as a form
(i.e. double-clicking it in Solution Explorer opens up the code file, not
the form designer). Also, it does not appear to recognize the code
file....there are no outlining indicators, typing in the code file there is

Right-click the file in solution explorer and choose "Open with...". Is the
Forms editor for Visual Basic available there?
 
Hi Dave

I've seen this happen when you are browsing a file that hasn't been added to
a project. Have you tried doing an Add | Existing Item in Solution
Explorer...?

Nigel
 
Thanks for the quick reply

Yes, "Visual Basic Form Editor (Default)" is listed...clicking on it brings
up the code for the form but it does not appear to be the standard code
editor (i.e. still no outline marks and no Intellisense). Also, I notice on
the context menu that the "View Code" option is missing, the only option in
that section of the menu is "View Designer".

I also tried Open With...Visual Basic Editor and gives the same
result....something that looks like a code editor but is not.

And it is only this one form...all the other forms work as expected.

I've also tried to exclude from project and then Add Existing Item...same
result....

Thanks

Dave Taylor
PERI
 
Nigel,

Thanks for the reply. Yes, I've tried Exclude from Project and Add Existing
Item to bring it back into the project....it gives the same result. I also
removed it from the project, replaced it with the backup files of the form
(.vb and .resx), then added it back into the project....same result.

-- Dave Taylor
PERI
 
Dave

A simple solution,

Add a new form to your project
Copy all code from your old project
Paste it in your newform
Exclude (not delete direct) that old form from your project

I hope this helps?

Cor

"Dave Taylor"
..
Thanks for the quick reply

Yes, "Visual Basic Form Editor (Default)" is listed...clicking on it
brings up the code for the form but it does not appear to be the standard
code editor (i.e. still no outline marks and no Intellisense). Also, I
notice on the context menu that the "View Code" option is missing, the
only option in that section of the menu is "View Designer".

I also tried Open With...Visual Basic Editor and gives the same
result....something that looks like a code editor but is not.

And it is only this one form...all the other forms work as expected.

I've also tried to exclude from project and then Add Existing Item...same
result....

Thanks

Dave Taylor
PERI
 
OK....dont ask me why, but using "Delete" rather than just "Exclude from
Project" fixed the problem. Deleted the files, and then I restored them
from a backup and voila.

Though for some reason it now shows the resx file for the form as well in
Solution Explorer...but hey, thats an anomly I can still compile with! :

Thanks for the input Nigel & Herfried.

-- Dave Taylor
 
Dave Taylor said:
Though for some reason it now shows the resx file for the form as well in
Solution Explorer...but hey, thats an anomly I can still compile with! :

Maybe the "Show all files" button on top of the solution explorer is
pressed.
 
Dave Taylor said:
Thanks...that is simple and would've worked (just tried it to be
sure)...Delete and restoring it from backup also seemed to work for some
reason.

.... and preserves resources too...
 
Cor,

Thanks...that is simple and would've worked (just tried it to be
sure)...Delete and restoring it from backup also seemed to work for some
reason.

-- Dave Taylor


Cor Ligthert said:
Dave

A simple solution,

Add a new form to your project
Copy all code from your old project
Paste it in your newform
Exclude (not delete direct) that old form from your project

I hope this helps?

Cor

"Dave Taylor"
.
 
Nope....show all files isnt pressed. It shows the .resx file as a child
node of the form file. Its strange, but no big deal.

Thx
-- Dave Taylor
PERI
 

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

Back
Top