Surendra Sharma

Surendra Sharma

Search This Blog

Tuesday, July 23, 2013

’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"

No comments:

Post a Comment