Monday, April 22, 2019

UI disappeared in winforms

I had a problem with one of my winforms in an application that was upgraded.  There were several problems with the form

1.  None of the UI elements were visible in design time.
2.  Upon build vb generated an initializecomponet sub in the form's backend (not in the designer.vb) which conflicted with the initializecomponet sub in the designer.vb.  
3.  The designer.vb did not appear under its form in the solution explorer tree, but as a separate file.

The problem was the vbproj file was corrupted.  Here is how a form should appear in the xml file:

 
      EditHTML.vb
   
   
      Form
   
  
 
      EditHTML.vb
   

Some of the dependencies were missing.  When they were fixed to the above format.  Everything worked.