AlexGasconB
AlexGasconB

Reputation: 175

Ambiguous in the namespace

I've updated a project from VB6 to VB.NET. Everything seemed to work fine, but now I'm facing errors related to the namespace when trying to build. Besides, I'm getting them on Form's designers, which have been automatically generated by Visual Studio. More specifically, the errors I'm facing involve the System.Drawing namespace and its internal structures (Point, Size, SizeF, etc).

I've checked it and I haven't found any other class that could be causing the conflict. I've also tried to delete the reference to the library and add it again, and to Clean the project, but the error is still there.

It's seems a problem similar to the one asked in this question, but I've tried the solutions answered there and haven't worked either. Any ideas of what could I do? This is driving me crazy and my whole project is stopped until I can fix that.

Thank you very, very much in advance.

EDIT: Added screenshots of the error and the code that's throwing it

Error's screenshot

Complete message of one of the errors: Error 18 'Point' is ambiguous in the namespace 'System.Drawing'. C:\Users\practiquesINF\Desktop\Projecte01_VBNET_V2\Upgraded\Frm_Files.Designer.vb 152 39 P_IF01

Code's screenshot

Complete code of one of the files that throws the error (as I've said, it's the designer of one of the forms and it has been generated automatically):

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Frm_Files
#Region "Upgrade Support "
    Private Shared m_vb6FormDefInstance As Frm_Files
    Private Shared m_InitializingDefInstance As Boolean
    Public Shared Property DefInstance() As Frm_Files
        Get
            If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
                m_InitializingDefInstance = True
                m_vb6FormDefInstance = CreateInstance()
                m_InitializingDefInstance = False
            End If
            Return m_vb6FormDefInstance
        End Get
        Set(ByVal Value As Frm_Files)
            m_vb6FormDefInstance = Value
        End Set
    End Property
#End Region
#Region "Windows Form Designer generated code "
    Public Shared Function CreateInstance() As Frm_Files
        Dim theInstance As Frm_Files = New Frm_Files()
        theInstance.Form_Load()
        Return theInstance
    End Function
    Private visualControls() As String = New String() {"components", "ToolTipMain", "_Text1_4", "DataCombo1", "_Text1_3", "_Text1_2", "_Command1_2", "_Command1_1", "_Text1_1", "_Text1_0", "_Command1_0", "CommonDialog1Open", "_Label1_6", "_Label1_5", "_Label1_4", "_Label1_3", "_Label1_2", "_Label1_1", "_Label1_0", "Command1", "Label1", "Text1"}
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
    Public ToolTipMain As System.Windows.Forms.ToolTip
    Private WithEvents _Text1_4 As System.Windows.Forms.TextBox
    Public WithEvents DataCombo1 As AxMSDataListLib.AxDataCombo
    Private WithEvents _Text1_3 As System.Windows.Forms.TextBox
    Private WithEvents _Text1_2 As System.Windows.Forms.TextBox
    Private WithEvents _Command1_2 As System.Windows.Forms.Button
    Private WithEvents _Command1_1 As System.Windows.Forms.Button
    Private WithEvents _Text1_1 As System.Windows.Forms.TextBox
    Private WithEvents _Text1_0 As System.Windows.Forms.TextBox
    Private WithEvents _Command1_0 As System.Windows.Forms.Button
    Public WithEvents CommonDialog1Open As System.Windows.Forms.OpenFileDialog
    Private WithEvents _Label1_6 As System.Windows.Forms.Label
    Private WithEvents _Label1_5 As System.Windows.Forms.Label
    Private WithEvents _Label1_4 As System.Windows.Forms.Label
    Private WithEvents _Label1_3 As System.Windows.Forms.Label
    Private WithEvents _Label1_2 As System.Windows.Forms.Label
    Private WithEvents _Label1_1 As System.Windows.Forms.Label
    Private WithEvents _Label1_0 As System.Windows.Forms.Label
    Public Command1(2) As System.Windows.Forms.Button
    Public Label1(6) As System.Windows.Forms.Label
    Public Text1(4) As System.Windows.Forms.TextBox
    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
     Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container()
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Frm_Files))
        Me.ToolTipMain = New System.Windows.Forms.ToolTip(Me.components)
        Me._Text1_4 = New System.Windows.Forms.TextBox()
        Me.DataCombo1 = New AxMSDataListLib.AxDataCombo()
        Me._Text1_3 = New System.Windows.Forms.TextBox()
        Me._Text1_2 = New System.Windows.Forms.TextBox()
        Me._Command1_2 = New System.Windows.Forms.Button()
        Me._Command1_1 = New System.Windows.Forms.Button()
        Me._Text1_1 = New System.Windows.Forms.TextBox()
        Me._Text1_0 = New System.Windows.Forms.TextBox()
        Me._Command1_0 = New System.Windows.Forms.Button()
        Me.CommonDialog1Open = New System.Windows.Forms.OpenFileDialog()
        Me._Label1_6 = New System.Windows.Forms.Label()
        Me._Label1_5 = New System.Windows.Forms.Label()
        Me._Label1_4 = New System.Windows.Forms.Label()
        Me._Label1_3 = New System.Windows.Forms.Label()
        Me._Label1_2 = New System.Windows.Forms.Label()
        Me._Label1_1 = New System.Windows.Forms.Label()
        Me._Label1_0 = New System.Windows.Forms.Label()
        CType(Me.DataCombo1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        '_Text1_4
        '
        Me._Text1_4.AcceptsReturn = True
        Me._Text1_4.BackColor = System.Drawing.SystemColors.Window
        Me._Text1_4.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Text1_4.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Text1_4.Location = New System.Drawing.Point(160, 200)
        Me._Text1_4.MaxLength = 1
        Me._Text1_4.Name = "_Text1_4"
        Me._Text1_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Text1_4.Size = System.Drawing.Size(19, 20)
        Me._Text1_4.TabIndex = 14
        Me._Text1_4.Text = "S"
        Me._Text1_4.Visible = False
        '
        'DataCombo1
        '
        Me.DataCombo1.Location = New System.Drawing.Point(112, 240)
        Me.DataCombo1.Name = "DataCombo1"
        Me.DataCombo1.OcxState = CType(resources.GetObject("DataCombo1.OcxState"), System.Windows.Forms.AxHost.State)
        ' Me.DataCombo1.RowSource = Nothing      HI HA QUE AFEGIR UN DATA SOURCE O SINO EL PROBLEMA NO GENERA EL FORMULARI
        Me.DataCombo1.Size = New System.Drawing.Size(233, 21)
        Me.DataCombo1.TabIndex = 13
        '
        '_Text1_3
        '
        Me._Text1_3.AcceptsReturn = True
        Me._Text1_3.BackColor = System.Drawing.SystemColors.Window
        Me._Text1_3.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Text1_3.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Text1_3.Location = New System.Drawing.Point(270, 112)
        Me._Text1_3.MaxLength = 0
        Me._Text1_3.Name = "_Text1_3"
        Me._Text1_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Text1_3.Size = New System.Drawing.Size(67, 20)
        Me._Text1_3.TabIndex = 10
        Me._Text1_3.Text = "19"
        Me._Text1_3.Visible = False
        '
        '_Text1_2
        '
        Me._Text1_2.AcceptsReturn = True
        Me._Text1_2.BackColor = System.Drawing.SystemColors.Window
        Me._Text1_2.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Text1_2.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Text1_2.Location = New System.Drawing.Point(113, 111)
        Me._Text1_2.MaxLength = 0
        Me._Text1_2.Name = "_Text1_2"
        Me._Text1_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Text1_2.Size = New System.Drawing.Size(43, 20)
        Me._Text1_2.TabIndex = 8
        Me._Text1_2.Text = "32"
        Me._Text1_2.Visible = False
        '
        '_Command1_2
        '
        Me._Command1_2.BackColor = System.Drawing.SystemColors.Control
        Me._Command1_2.Cursor = System.Windows.Forms.Cursors.Default
        Me._Command1_2.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Command1_2.Location = New System.Drawing.Point(155, 272)
        Me._Command1_2.Name = "_Command1_2"
        Me._Command1_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Command1_2.Size = New System.Drawing.Size(78, 33)
        Me._Command1_2.TabIndex = 6
        Me._Command1_2.Text = "Cancel"
        Me._Command1_2.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
        Me._Command1_2.UseVisualStyleBackColor = False
        '
        '_Command1_1
        '
        Me._Command1_1.BackColor = System.Drawing.SystemColors.Control
        Me._Command1_1.Cursor = System.Windows.Forms.Cursors.Default
        Me._Command1_1.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me._Command1_1.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Command1_1.Location = New System.Drawing.Point(245, 266)
        Me._Command1_1.Name = "_Command1_1"
        Me._Command1_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Command1_1.Size = New System.Drawing.Size(97, 40)
        Me._Command1_1.TabIndex = 5
        Me._Command1_1.Text = "OK"
        Me._Command1_1.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
        Me._Command1_1.UseVisualStyleBackColor = False
        '
        '_Text1_1
        '
        Me._Text1_1.AcceptsReturn = True
        Me._Text1_1.BackColor = System.Drawing.SystemColors.Window
        Me._Text1_1.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Text1_1.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Text1_1.Location = New System.Drawing.Point(114, 82)
        Me._Text1_1.MaxLength = 0
        Me._Text1_1.Name = "_Text1_1"
        Me._Text1_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Text1_1.Size = New System.Drawing.Size(225, 20)
        Me._Text1_1.TabIndex = 2
        Me._Text1_1.Text = "c:\cgc\RUSTICA.TXT"
        '
        '_Text1_0
        '
        Me._Text1_0.AcceptsReturn = True
        Me._Text1_0.BackColor = System.Drawing.SystemColors.Window
        Me._Text1_0.Cursor = System.Windows.Forms.Cursors.IBeam
        Me._Text1_0.ForeColor = System.Drawing.SystemColors.WindowText
        Me._Text1_0.Location = New System.Drawing.Point(113, 53)
        Me._Text1_0.MaxLength = 0
        Me._Text1_0.Name = "_Text1_0"
        Me._Text1_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Text1_0.Size = New System.Drawing.Size(225, 20)
        Me._Text1_0.TabIndex = 1
        Me._Text1_0.Text = "c:\cgc\240padrus.cnt"
        '
        '_Command1_0
        '
        Me._Command1_0.BackColor = System.Drawing.SystemColors.Control
        Me._Command1_0.Cursor = System.Windows.Forms.Cursors.Default
        Me._Command1_0.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Command1_0.Location = New System.Drawing.Point(248, 7)
        Me._Command1_0.Name = "_Command1_0"
        Me._Command1_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Command1_0.Size = New System.Drawing.Size(91, 38)
        Me._Command1_0.TabIndex = 0
        Me._Command1_0.Text = "Buscar Fitxer"
        Me._Command1_0.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageAboveText
        Me._Command1_0.UseVisualStyleBackColor = False
        '
        'CommonDialog1Open
        '
        '
        '_Label1_6
        '
        Me._Label1_6.BackColor = System.Drawing.SystemColors.Control
        Me._Label1_6.Cursor = System.Windows.Forms.Cursors.Default
        Me._Label1_6.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Label1_6.Location = New System.Drawing.Point(8, 205)
        Me._Label1_6.Name = "_Label1_6"
        Me._Label1_6.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Label1_6.Size = New System.Drawing.Size(137, 23)
        Me._Label1_6.TabIndex = 15
        Me._Label1_6.Text = "Firma Secretari (S/N):"
        Me._Label1_6.Visible = False
        '
        '_Label1_5
        '
        Me._Label1_5.BackColor = System.Drawing.SystemColors.Control
        Me._Label1_5.Cursor = System.Windows.Forms.Cursors.Default
        Me._Label1_5.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Label1_5.Location = New System.Drawing.Point(8, 248)
        Me._Label1_5.Name = "_Label1_5"
        Me._Label1_5.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Label1_5.Size = New System.Drawing.Size(97, 23)
        Me._Label1_5.TabIndex = 12
        Me._Label1_5.Text = "Remesa:"
        Me._Label1_5.Visible = False
        '
        '_Label1_4
        '
        Me._Label1_4.BackColor = System.Drawing.SystemColors.Control
        Me._Label1_4.Cursor = System.Windows.Forms.Cursors.Default
        Me._Label1_4.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Label1_4.Location = New System.Drawing.Point(8, 24)
        Me._Label1_4.Name = "_Label1_4"
        Me._Label1_4.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Label1_4.Size = New System.Drawing.Size(91, 19)
        Me._Label1_4.TabIndex = 11
        Me._Label1_4.Text = "Banc"
        Me._Label1_4.Visible = False
        '
        '_Label1_3
        '
        Me._Label1_3.BackColor = System.Drawing.SystemColors.Control
        Me._Label1_3.Cursor = System.Windows.Forms.Cursors.Default
        Me._Label1_3.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Label1_3.Location = New System.Drawing.Point(171, 112)
        Me._Label1_3.Name = "_Label1_3"
        Me._Label1_3.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Label1_3.Size = New System.Drawing.Size(99, 19)
        Me._Label1_3.TabIndex = 9
        Me._Label1_3.Text = "Pes de les Cartes:"
        Me._Label1_3.Visible = False
        '
        '_Label1_2
        '
        Me._Label1_2.BackColor = System.Drawing.SystemColors.Control
        Me._Label1_2.Cursor = System.Windows.Forms.Cursors.Default
        Me._Label1_2.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Label1_2.Location = New System.Drawing.Point(8, 116)
        Me._Label1_2.Name = "_Label1_2"
        Me._Label1_2.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Label1_2.Size = New System.Drawing.Size(97, 23)
        Me._Label1_2.TabIndex = 7
        Me._Label1_2.Text = "Remesa:"
        Me._Label1_2.Visible = False
        '
        '_Label1_1
        '
        Me._Label1_1.BackColor = System.Drawing.SystemColors.Control
        Me._Label1_1.Cursor = System.Windows.Forms.Cursors.Default
        Me._Label1_1.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Label1_1.Location = New System.Drawing.Point(8, 85)
        Me._Label1_1.Name = "_Label1_1"
        Me._Label1_1.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Label1_1.Size = New Drawing.Size(97, 23)
        Me._Label1_1.TabIndex = 4
        Me._Label1_1.Text = "Fitxer d'Eixida:"
        '
        '_Label1_0
        '
        Me._Label1_0.BackColor = System.Drawing.SystemColors.Control
        Me._Label1_0.Cursor = System.Windows.Forms.Cursors.Default
        Me._Label1_0.ForeColor = System.Drawing.SystemColors.ControlText
        Me._Label1_0.Location = New System.Drawing.Point(8, 55)
        Me._Label1_0.Name = "_Label1_0"
        Me._Label1_0.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me._Label1_0.Size = New System.Drawing.Size(97, 22)
        Me._Label1_0.TabIndex = 3
        Me._Label1_0.Text = "Fitxer d'Entrada:"
        '
        'Frm_Files
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.BackColor = System.Drawing.SystemColors.Control
        Me.ClientSize = New System.Drawing.Size(364, 324)
        Me.Controls.Add(Me._Text1_4)
        Me.Controls.Add(Me.DataCombo1)
        Me.Controls.Add(Me._Text1_3)
        Me.Controls.Add(Me._Text1_2)
        Me.Controls.Add(Me._Command1_2)
        Me.Controls.Add(Me._Command1_1)
        Me.Controls.Add(Me._Text1_1)
        Me.Controls.Add(Me._Text1_0)
        Me.Controls.Add(Me._Command1_0)
        Me.Controls.Add(Me._Label1_6)
        Me.Controls.Add(Me._Label1_5)
        Me.Controls.Add(Me._Label1_4)
        Me.Controls.Add(Me._Label1_3)
        Me.Controls.Add(Me._Label1_2)
        Me.Controls.Add(Me._Label1_1)
        Me.Controls.Add(Me._Label1_0)
        Me.Cursor = System.Windows.Forms.Cursors.Default
        Me.Location = New System.Drawing.Point(3, 18)
        Me.Name = "Frm_Files"
        Me.RightToLeft = System.Windows.Forms.RightToLeft.No
        Me.Text = "Fitxers d'entrada i Eixida"
        CType(Me.DataCombo1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Sub ReLoadForm(ByVal addEvents As Boolean)
        InitializeText1()
        InitializeLabel1()
        InitializeCommand1()
        Form_Load()
        If addEvents Then
            AddHandler MyBase.Closed, AddressOf Me.Frm_Files_Closed
        End If
    End Sub
    Sub InitializeText1()
        ReDim Text1(4)
        Me.Text1(4) = _Text1_4
        Me.Text1(3) = _Text1_3
        Me.Text1(2) = _Text1_2
        Me.Text1(1) = _Text1_1
        Me.Text1(0) = _Text1_0
    End Sub
    Sub InitializeLabel1()
        ReDim Label1(6)
        Me.Label1(6) = _Label1_6
        Me.Label1(5) = _Label1_5
        Me.Label1(4) = _Label1_4
        Me.Label1(3) = _Label1_3
        Me.Label1(2) = _Label1_2
        Me.Label1(1) = _Label1_1
        Me.Label1(0) = _Label1_0
    End Sub
    Sub InitializeCommand1()
        ReDim Command1(2)
        Me.Command1(2) = _Command1_2
        Me.Command1(1) = _Command1_1
        Me.Command1(0) = _Command1_0
    End Sub
#End Region
End Class

In case this is relevant for the question, the form was upgraded from VB6 to VB.NET using an automatic tool. Specifically, the VBUC by Mobilize.net (I do not intend to do this as spam, but to give as much information as I can. If I shouldn't have done this, I'll edit the post and delete the reference)

Upvotes: 2

Views: 7156

Answers (1)

AlexGasconB
AlexGasconB

Reputation: 175

Finally, I've managed to solve it! It seems that one of the external libraries I was using was creating a conflict. As Visual Studio didn't tell my which one it was, I simply unreferenced them all and then referenced again only the ones that I needed at that exact moment.

The conflict seemed to be caused by one of the libraries of the GrapeCity's ActiveReport tool. As I had to upgrade the tool and it wasn't code that I had written (and it was quite poorly commented), I didn't know which ones were or will be needed, so I referenced more than necessary. And it seems that precisely one of the extra libraries (I'm not sure at all, but I think that it was one of the Chart ones) was the one causing the conflict.

Thank you all for your help! And sorry for not answering before, but I had to switch to another urgent project and I couldn't try the solutions until today.

Upvotes: 1

Related Questions