我的老板给了我不同的从VB6转换到VB2005(2.0 .Net框架)然后转换到VB2010(4.0 .Net框架)。
当我转换时,我发现了VB2005到VB2010的警告,
警告'Microsoft.VisualBasic.Compatibility.VB6.RadioButtonArray'已过时:'Microsoft.VisualBasic.Compatibility。*类已过时,仅在32位进程内受支持。 http://go.microsoft.com/fwlink/?linkid=160862”。
警告类型库导入程序无法转换成员'DISPPARAMS.rgdispidNamedArgs'的签名。
警告类型库导入程序无法转换成员'DISPPARAMS.rgvarg'的签名。
如果我忽略它,程序仍然可以在调试模式下运行成功,但是当我以.exe运行时,它在 bin文件夹将在运行某些功能时终止。
有人可以告诉我为什么以及如何详细解决它?请。 如果您有关于转换vb到vb.net的任何好的网站,请与我们分享=]
答案 0 :(得分:0)
VB6允许您相当容易地制作控制数组,RadioButtonArray是一个构造,可以从Control数组转换为可以以相同方式使用的东西。我总是发现通过创建控件类型的空数组并使用Tag属性作为索引然后将控件分配给新数组来更容易地读取结果。
此示例假定您有4个RadioButton,其Tag属性设置为0到3.
Public Class Form1
Dim rbArray(3) As RadioButton
Public Sub New()
' This call is required by the designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
For Each cntrl As Control In Me.Controls
If TypeOf cntrl Is RadioButton Then
Dim rb As RadioButton = CType(cntrl, RadioButton)
rbArray(CInt(rb.Tag)) = rb
End If
Next
End Sub
End Class
Common EventHandler示例
Private Sub RadioButton_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles RadioButton1.CheckedChanged, RadioButton2.CheckedChanged, RadioButton3.CheckedChanged, RadioButton4.CheckedChanged
Dim rb As RadioButton = CType(sender, RadioButton)
Select Case CInt(rb.Tag) 'Note use of Tag instead of Index
Case 0
Case 1
Case 2
Case 3
End Select
End Sub