Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, July 23, 2013

'MSCOMCTL.OCX' cound not be loadded--Continue Loading Project?

If you are getting error as "'MSCOMCTL.OCX' cound not be loadded--Continue Loading Project?"

Solution: -
It simply means that system don’t have file “'MSCOMCTL.OCX”. To fix this error follow below steps
·         Download and install VisualBasic6-KB896559-v1-ENU.exe from http://www.microsoft.com/en-in/download/details.aspx?id=10019
·         You need to restart system
·         Run following command to register MSCOMCTL.OCX component

o    regsvr32  C:\Windows\System32\MSCOMCTL.OCX

'As Any' is not supported in 'Declare' statements.

During migration from VB to VB.NET if you are getting error as "'As Any' is not supported in 'Declare' statements." with following type of code


'UPGRADE_ISSUE: Declaring a parameter 'As Any' is not supported.
Declare Function FindWindow Lib "user32"  Alias "FindWindowA"(ByVal lpClassName As String, ByVal lpWindowName As Any) As Integer

Solution: -

Find all the references of method “FindWindow” in project and check which type of values are passed to method “FindWindow”. Replace “Any” with passed value data type. If more than one data types are used then create overloaded method.


Declare Function FindWindow Lib "user32"  Alias "FindWindowA"(ByVal lpClassName As String, ByVal lpWindowName As String) As Integer

'OpenForms' is not a member of 'My.MyApplication'.

During migration from VB to VB.NET if you are getting error as "'OpenForms' is not a member of 'My.MyApplication'." 


Solution: -


Right click Project Proerties -> Application -> Checked Enable Application framework

’Value of type 'String' cannot be converted to 'System.Windows.Forms.ListViewItem.ListViewSubItem'.

During migration from VB to VB.NET if you are getting error as "’Value of type 'String' cannot be converted to 'System.Windows.Forms.ListViewItem.ListViewSubItem'." with following type of code


'UPGRADE_WARNING: Lower bound of collection mylistview.ListItems has changed from 1 to 0
'UPGRADE_WARNING: Lower bound of collection mylistview.ListItems().ListSubItems has changed from 1 to 0. 'UPGRADE_WARNING: Couldn't resolve default property of object mylistview.ListItems().ListSubItems().

mylistview.Items.Item(currentIndex).SubItems.Item(1) = "Test"

Solution: -

Use “Text” property to assign value as below


mylistview.Items.Item(currentIndex).SubItems.Item(1).Text = "Test"

’Value of type 'Microsoft.VisualBasic.FileAttribute' cannot be converted to 'System.Windows.Forms.Cursor'.

During migration from VB to VB.NET if you are getting error as "’Value of type 'Microsoft.VisualBasic.FileAttribute' cannot be converted to 'System.Windows.Forms.Cursor'." with following type of code

'UPGRADE_ISSUE: Unable to determine which constant to upgrade vbNormal to. 'UPGRADE_ISSUE: Screen property Screen.MousePointer does not support custom mousepointers.
'UPGRADE_WARNING: Screen property Screen.MousePointer has a new behavior.
System.Windows.Forms.Cursor.Current = vbNormal

Solution: -
Use “Cursors.Default” as below


System.Windows.Forms.Cursor.Current = Cursors.Default

'NewIndex' is not a member of 'System.Windows.Forms.CheckedListBox'

During migration from VB to VB.NET if you are getting error as "'NewIndex' is not a member of 'System.Windows.Forms.CheckedListBox'" with following type of code


myCheckedListBox.Items.Add("MatchName")
'UPGRADE_ISSUE: ListBox property myCheckedListBox.NewIndex was not upgraded. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="F649E068-7137-45E5-AC20-4D80A3CC70AC"'
myCheckedListBox.SetSelected(myCheckedListBox.NewIndex, False)

Solution: -
Store number of newly added item of CheckedListBox in some variable and use that value in place of “NexIndex” as below

Dim currentItemNumber As Integer = myCheckedListBox.Items.Add("MatchName")

myCheckedListBox.SetSelected(currentItemNumber, False)

'SelLength' is not a member of 'System.Windows.Forms.Control'.

During migration from VB to VB.NET if you are getting error as "'SelLength' is not a member of 'System.Windows.Forms.Control'." with following type of code


'UPGRADE_WARNING: Couldn't resolve default property of object mytextbox.SelLength.
mytextbox.SelLength = 0
Solution: -
Use new property “SelectionLength” as below

mytextbox.SelectionLength = 0