I've created an application in VB.Net consisting of a couple of forms with listboxes and listviews showing lists of procedures and tables in a database. It works fine in debug mode in Visual Studio - I get no exceptions. But when I compile it and open the .exe it throws an exception when the second form opens, saying one of the parameter values is incorrect.
I have a line of code referencing the fifth subitem of a listitem in a listview:
.SubItems(5).Text = vbNullString
The error message is "InvalidArgument=Value of '5' is not valid for 'index'". But there are 5 subitems in the listview so what's wrong with it?