0

My boss given me different conversion from VB6 to VB2005(2.0 .Net framework) then to VB2010(4.0 .Net framework).

when i being converting, i found this warning from VB2005 to VB2010,

Warning 'Microsoft.VisualBasic.Compatibility.VB6.RadioButtonArray' is obsolete: 'Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862'.

Warning The type library importer could not convert the signature for the member 'DISPPARAMS.rgdispidNamedArgs'.

Warning The type library importer could not convert the signature for the member 'DISPPARAMS.rgvarg'.

if i ignore it, program can still run success in debug mode, but when i run as .exe which in bin folder will terminate when running some function.

Can anyone tell me why and how to solve it in detail?Please. if you have any good websit about conversion vb to vb.net, please share with us =]

user1506228
  • 45
  • 4
  • 10
  • 2
    "terminate when running some function"? Can you be more specific? The crash may be down to anything, even the path, and not necassarily the VB6 compatability framework. Is your development machine runnign a 64-bit machine? – Deanna Jul 06 '12 at 11:12
  • hello, i have some report function , when i run these function, it will show the message box about:xxx.exe has encountered a problem and needs to close. it still work in vb2005 but after convert to 2010, the .exe cant run when i use report function. i also read the event log from PC. it said .NET runtime 4.0 error Reporting. – user1506228 Jul 09 '12 at 06:43

1 Answers1

0

VB6 allowed you to make Control Arrays fairly easily, the RadioButtonArray was a construct to enable conversion from a Control array to something that could be used in the same way. I have always found it easier to read the result by creating an empty array of the type of the control and use the Tag property as an index then assign the Controls to the new Array.

This example assumes that you have 4 RadioButtons with their Tag properties set from 0 to 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

Example of 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
Mark Hall
  • 53,938
  • 9
  • 94
  • 111
  • thank you, i am beginner, what is the mean of cntrl? also this error, should i delete the error of VB6.RadioButtonArray and write a new code like your example to solve it? – user1506228 Jul 09 '12 at 01:24
  • I probably should have wrote that as `For Each cntrl As Control in Me.Controls` I will edit example. If it were me that is what I would do get away from the VB6.RadioButtonArray and use Control Array's Instead. You will have to make sure that the events are assigned to each radiobutton. I will add some code to show that also. There is no realy clean way to do it. but it should take care of your problem – Mark Hall Jul 09 '12 at 01:37
  • got it and thank you so much, do you have any idea about the error of Warning The type library importer could not convert the signature for the member 'DISPPARAMS.rgdispidNamedArgs'.? – user1506228 Jul 09 '12 at 04:28
  • @user1506228 Thats a new one to me, see if this [MSDN Forum Link](http://social.msdn.microsoft.com/Forums/en-US/clr/thread/37654e9b-e484-43dc-8e3b-9f6344d42055/) is applicable. If not try posting another question and show the code that is throwing it and what type libraries are being imported into your project – Mark Hall Jul 09 '12 at 04:36
  • thank you so much for the Microsoft.VisualBasic.Compatibility.VB6.RadioButtonArray error was solved. Do you have any idea to solve convert the signature? Now whenever i run exe from the bin and click report function, it will said that XXX.exe has encountered a problem and needs to close. in the debug mode is alright. how cloud i solve it? i have been this error for a week... – user1506228 Jul 09 '12 at 10:13