A set of .NET Framework managed libraries for developing graphical user interfaces.
Hi @Rob Sandham ,
I'm sorry you're running into this frustrating issue. The "Sequence contains no elements" error is coming from the Visual Studio Windows Forms Designer. Since this started while copying and renaming controls, one possible cause is that a control name was not updated consistently in the generated .Designer.vb file.
Before making manual changes, please back up your project or commit your current changes to source control.
1. Check the .Designer.vb file
- In Solution Explorer, select Show All Files if the designer file is not visible.
- Expand your form, such as
Form1.vb, and openForm1.Designer.vb. - Search for the control that was copied or renamed.
- Check whether its name is consistent in the declaration, initialization, property assignments, and
Controls.Addstatements. - If you find an obvious mismatch between the old and new control names, correct it, save the file, and rebuild the project.
Avoid changing unrelated designer-generated code.
2. Clean and rebuild the solution
- Close the form designer.
- Select Build > Clean Solution.
- Select Build > Rebuild Solution.
- Reopen the form designer.
3. Clear the generated build files
If the issue continues:
- Close Visual Studio completely.
- Open the project folder in File Explorer.
- Delete the
binandobjfolders. - Reopen Visual Studio and rebuild the solution.
For more information, see Microsoft's Windows Forms design-time error troubleshooting guidance.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guidance or provide feedback.
Thank you.