question

Havooma-1991 avatar image
0 Votes"
Havooma-1991 asked JiachenLiMFST-9349 commented

Visual Basic form, cannot open in Form Design view

So I made a mistake on one of my VB forms and deleted something I shouldnt have. No bother because I backed up the last version of the program I made a month ago.

Planned to delete the form in the Solution Explorer then go to Add -> Existing and select the form from the previous version.

I note that the form I am after has 3 files associated, a .vb, .resx and .Designer.vb. When I added this form, I used the .vb file.

It appears then in the solution explorer and works when I then run the software. However, Ive tried everything but cand open this form in the Form designer, when I double click on it, I just get the code view.

All 3 files have been imprted into the Solution Explorer, the .Designer.vb and .resx sit below the .vb file in the tree.

What I did notice is that the icon for this form is now 'VB' rather than a form icon. There is also no option to 'View Designer' when clicking on it.

Im sure Ive tried every single combination of everything! Is there something special I need to do when I add an existing, to ensure it is recognised as a form, not a 'VB'?

dotnet-visual-basicwindows-forms
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @Havooma-1991 ,
May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·
cooldadtx avatar image
0 Votes"
cooldadtx answered

Edit the project file in a text editor. Find the Form.cs file that you added back. Add a subtype of Form.

<Compile Include="MyForm.vb">
   <SubType>Form</SubType>
</Compile>
<Compile Include="MyForm.designer.vb">
   <DependentUpon>MyForm.vb</DependentUpon>
   <SubType>Form</SubType>
</Compile>


Save and reload the project.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

JiachenLiMFST-9349 avatar image
0 Votes"
JiachenLiMFST-9349 answered JiachenLiMFST-9349 edited

Hi @Havooma-1991 ,

  1. Open the previous project directory and copy the three files of the form to the new project directory.

  2. Then go to Add -> Existing and select Copied Form.

Hope this could be helpful.
Best Regards.
Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.