我已经将项目从VB6更新为VB.NET。一切似乎都运行良好,但现在我在尝试构建时遇到与命名空间相关的错误。此外,我在Form的设计器上获取它们,这些设计器是由Visual Studio自动生成的。更具体地说,我面临的错误涉及System.Drawing
命名空间及其内部结构(Point
,Size
,SizeF
等)。
我已经检查了它,但我没有找到任何可能导致冲突的其他类。我还试图删除对库的引用并再次添加它,并清理项目,但错误仍然存在。
这似乎是一个与this question中提到的问题类似的问题,但我已经尝试过在那里解答的解决方案,但也没有用。关于我能做什么的任何想法?这让我发疯,我的整个项目都停止了,直到我能解决这个问题。
非常非常感谢你。
编辑:添加了错误的屏幕截图和抛出它的代码
完成其中一个错误的消息: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
抛出错误的其中一个文件的完整代码(正如我所说,它是其中一个表单的设计者并且已经自动生成):
<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(我不打算将此作为垃圾邮件,但要提供尽可能多的信息。如果我不应该这样做,我将编辑帖子并删除引用)< / p>
答案 0 :(得分:1)
最后,我设法解决了它!似乎我使用的一个外部库正在产生冲突。由于Visual Studio没有告诉我它是哪一个,我只是将它们全部推荐出来然后再次引用那些我在那个时刻需要的那些。
冲突似乎是由GrapeCity的ActiveReport工具库中的一个引起的。由于我必须升级该工具并且它不是我编写的代码(而且评论很差),我不知道哪些是或将需要的,所以我引用的不仅仅是必要的。似乎正是其中一个额外的库(我根本不确定,但我认为它是图表中的一个)是导致冲突的库。
谢谢大家的帮助!很抱歉没有回答,但我不得不切换到另一个紧急项目,直到今天我都无法尝试解决方案。