我的老板给了我不同的转换,从VB6到VB2005(2.0 .Net框架),再到VB2010(4.0 .Net框架)。
当我转换时,我发现了从VB2005到VB2010的警告,
警告'Microsoft.VisualBasic.Compatibility.VB6.RadioButtonArray‘是过时的:“Microsoft.VisualBasic.Compatiability.*类过时,仅在32位进程中支持.http://go.microsoft.com/fwlink/?linkid=160862”。
警告类型库导入程序无法转换成员“DISPPARAMS.rgdisidNamedArgs”的签名。
警告类型库导入程序无法转换成员“DISPPARAMS.rgvarg”的签名。
如果忽略它,程序仍然可以在调试模式下成功运行,但是当我作为.exe运行时,在bin文件夹中的哪个程序在运行某些函数时会终止。
有人能告诉我为什么和如何详细解决吗?请。如果您有任何关于将vb转换为vb.net的好网站,请与我们分享]
发布于 2012-07-06 15:53:33
VB6允许您很容易地生成控制数组,RadioButtonArray是一个结构,用于从Control转换到可以以同样方式使用的东西。通过创建控件类型的空数组,并使用Tag属性作为索引,然后将控件分配给新的Array,我发现读取结果更容易。
本例假设您有4个RadioButtons,其标记属性设置为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通用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 Subhttps://stackoverflow.com/questions/11359176
复制相似问题