In a Visual Basic project, I created a homemade TabControl in order to fix a visual bug. The control works properly, however whenever I modify the form using my tab, Visual Studio adds MyProject in front of the control in its declaration:
Me.tabMenu = New MyProject.MyClass 'Gives a BC30002 compile error
If I remove the MyProject., the project compiles properly.
MyClass is in a separate file MyClass.vb and looks mostly like this:
Public Class MyClass Inherits System.Windows.Forms.TabControl Public Sub New() InitializeComponent() MyBase.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed End Sub Protected Overrides Sub OnDrawItem(ByVal e As System.Windows.Forms.DrawItemEventArgs) //OnDrawItem code End Sub Private Sub My_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem //My_DrawItem code End Sub End Class
I tried removing the file and adding it again, copy and pasting the class inside MyForm.designer.vb, adding MyProject. to the class name, but nothing stopped Visual Studio from adding this so-hated MyProject.
Edit regarding this answer:
I understand the thing about the namespace, however my problem is mostly that the compiler does not recognize the class with the project name appended but still adds it everytime.
I’ve seen this before when you have a public module with the same name as your default namespace (project name). If that’s the case, either rename the module or the default namespace and the problem should go away,.