VB Migration Partner fully supports the ScriptControl as well as other classes defined in the MSScriptControlLib type library. However, in some cases you need to tweak the VB.NET code produced by the migration process. For example, consider the following code in a Standard EXE project:
Public GlobalFields As New Fields
Private Sub Form_Load()
Me.ScriptControl1.AddObject "GlobalFields", GlobalFields, True
End Sub
where the Fields class is defined elsewhere in the project; being a Standard EXE project, the Fields class is inherently private.
The above code is correctly converted to VB.NET, yet you get a runtime error in the AddObject method, because the Fields class isn’t visible to COM (and therefore to the ScriptControl instance):
Friend Class Fields
End Class
You can fix this issue by manually changing the VB.NET code as follows:
<System.Runtime.InteropServices.ComVisible(True)> _
Public Class Fields
' ...
End Class
You can have VB Migration Partner perform this fix automatically by adding a proper PostProcess pragma inside the Fields.cls source file:
(Notice that the previous pragma must be entered on a single line.)