Microsoft bug in VB2015 : ‘Form 1’ is not a member…

Microsoft has introduced a bug into Visual Basic 2015 that is causing errors to appear in my sample projects for Teach Yourself Visual Basic 2015. Please note this bug did NOT appear in the final release we were given to write our books against; it was introduced after the book went to print.

You can see in this bug report, Microsoft reported that this was to be addressed in the Update 1 release. It is also logged here.

Unfortunately, the fix does not appear to have made it into the Update 1 release.

When you rename a form (usually by right-clicking the form in the Solutions Explorer and choosing Rename), Visual Basic is supposed to update the Startup Form of the project to the new name of the form. This is not happening. If you rename a form and attempt to run the project, you will get the following error:

VBError01

Fortunately, fixing this issue is relatively easy. If you get this error in my book (or when renaming forms in your own projects), follow these steps:

1. Choose [Project Name] Properties from the Project menu.

VBError02

2. Notice below that the Startup form drop down list contains the old name of the form, even though the name has been changed; this is the bug. Open the Startup Form dropdown and select the new name of the form.

VBError03

 

That’s it – your project should run now!

PS: I have reached out to Microsoft and they are looking into this. I will post an update when I hear news…