2015-08-12 2 views
2

Я обновил проект от VB6 до VB.NET. Кажется, все работает нормально, но теперь я сталкиваюсь с ошибками, связанными с пространством имен при попытке создания. Кроме того, я получаю их на дизайнерах Формы, которые были автоматически созданы Visual Studio. Более конкретно, ошибки, с которыми я сталкиваюсь, включают пространство имен System.Drawing и его внутренние структуры (Point, Size, SizeF и т. Д.).Неоднозначное в пространстве имен

Я проверил его, и я не нашел другого класса, который мог бы вызвать конфликт. Я также попытался удалить ссылку на библиотеку и добавить ее снова, а также очистить проект, но ошибка все еще существует.

Это похоже на проблему, аналогичную заданной в this question, но я пробовал решения, ответы на которые там были и не работали. Какие-нибудь идеи о том, что я могу сделать? Это сводит меня с ума, и весь мой проект остановлен, пока я не смогу это исправить.

спасибо, очень заблаговременно.

EDIT: Добавлены скриншоты ошибки и код, который вбрасывающего

Error's screenshot

сообщение о завершении одного из ошибок: 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

Полный код одного из файлы, которые вызывают ошибку (как я уже сказал, это разработчик одной из форм, и она была сгенерирована автоматически):

<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 

В случае, если это относится к вопросу, форма была обновлена ​​с VB6 до VB.NET с использованием автоматического инструмента. В частности, VBUC by Mobilize.net (я не собираюсь делать это как спам, но чтобы предоставить как можно больше информации. Если бы я не сделал этого, я отредактировал сообщение и удалю ссылку)

+0

Не могли бы вы вносить точную ошибку? –

+0

Укажите код, точную ошибку, скриншоты. Вы уверены, что не используете/создаете свое пространство имен так же, как те, что содержатся в .NET BCL, и путем совместного использования с теми же классами/структурами? –

+0

Я отредактировал сообщение и добавил скриншоты и код. Не стесняйтесь спрашивать меня, должен ли я предоставить дополнительную информацию. – Psicomanchester

ответ

1

Наконец-то , Мне удалось это решить! Кажется, что одна из внешних библиотек, которые я использовал, создавала конфликт. Поскольку Visual Studio не рассказывала мне, какой из них она была, я просто не обращал на них внимания, а затем снова ссылался только на те, которые мне нужны в этот момент.

Конфликт, по-видимому, вызван одной из библиотек инструмента ActiveReport от GrapeCity. Поскольку мне пришлось обновить инструмент, и это был не код, который я написал (и он был очень плохо прокомментирован), я не знал, какие из них нужны или будут нужны, поэтому я ссылался больше, чем необходимо. И кажется, что именно одна из дополнительных библиотек (я не уверен, но думаю, что это был один из диаграмм) был причиной конфликта.

Спасибо вам за помощь! И жаль, что я не ответил раньше, но мне пришлось переключиться на другой срочный проект, и я не мог попробовать решения до сегодняшнего дня.

Смежные вопросы