Have you seen this? https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/name-is-ambiguous-in-the-namespace-namespacename
"BC30560 'Padding; is ambiguous in the namespace 'System.Windows.Forms'" suddenly appearing on an app that was working last week.
I'm creating a Windows Forms app in VB .net 6.0 and suddenly after reopening and trying to edit the app one of my designers won't open or run. This isn't the first time I've had issues with dotnet apps in Visual Studio and Visual Basic.
I was working like normal on the app last week, and even this morning. I closed it and reopened it to check against previous versions, then when I tried testing, I was met with this error in 7 places within just 1 form designer.
BC30560 'Padding' is ambiguous in the namespace 'System.Windows.Forms'.
I have tried fully qualifying my call of "Padding" by using System.Windows.Forms but no luck. This is what the design lines on each control for this page looks like.
' pic1
'
pic1.BackColor = Color.White
pic1.Location = New Point(588, 191)
pic1.Margin = New Padding(7, 8, 7, 8)
pic1.Name = "pic1"
pic1.Size = New Size(755, 216)
pic1.TabIndex = 0
pic1.TabStop = False
'
This is just the auto-generated design code created by the Visual Designer Window. I never touch these files, I never edit anything in here manually, but every so often, it gets 'corrupted' somehow and ruins the whole solution.
I have confirmed that the app originally targeted .net 6.0 and that it is currently targeting .net 6.0. I have tried commenting out the padding lines, but the designer still won't open. I have tried deleting the .vb.design file (while keeping it as a backup) and reopening the designer, in hopes it would regenerate the file, but it won't.
This happens enough to a point where we create several copies of every program we make in house for the floor... Except this time, my only previous version has hours of work missing from it. What's the deal?
How can I fix this error? And how can I prevent this from being an issue in the future? As we dive more into PowerApps, we are beginning to use that more for everything than VB, but sometimes using actual coding is easier than the limited PowerApps so.... Not to mention all of the legacy programs we have that still need supported until we can get them into PowerApps.
Thank you in advance.
2 answers
Sort by: Most helpful
-
-
Jiachen Li-MSFT 33,541 Reputation points Microsoft Vendor
2025-02-25T02:34:12.57+00:00 Hi @Kaleb Riley ,
Try the steps below to see if that helps.
- Make sure Visual Studio is up to date (
Help > Check for Updates
) and update all NuGet packages (Tools > NuGet Package Manager > Manage NuGet Packages for Solution
). - Clear and Rebuild the Project
- Delete the
.vs
Folder andbin
/obj
Folders - Manually Regenerate the Designer File: Temporarily rename the problematic .Designer.vb file. Create a new empty form in the project. Copy Designer Code: Copy the contents of the old .Designer.vb file (excluding the problematic lines) to the new form's designer. Re-add Controls: Manually add any problematic controls through the Visual Designer.
Best Regards.
Jiachen Li
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 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.
- Make sure Visual Studio is up to date (