listview out of range error.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 30 records going into my listview, and I know that it will fill from 0 - 29 in the listview
But when it gets to 29th item it throws an error telling me that ' Parameter Name: 29 is not a valid value for displayIndex

It doesn't make any sense to me.
frm.LvChJob.Items.Add(Job.JobName) 'job nam
frm.LvChJob.Items(lstCount).SubItems.Add(Job.JobDesc) 'job descriptio
frm.LvChJob.Items(lstCount).SubItems.Add(Job.JobComments
frm.LvChJob.Items(lstCount).SubItems.Add(Job.JobDate) 'date or da
 
I have 30 records going into my listview, and I know that it will fill from 0 - 29 in the listview.
But when it gets to 29th item it throws an error telling me that ' Parameter Name: 29 is not a valid value for displayIndex"

It doesn't make any sense to me.
frm.LvChJob.Items.Add(Job.JobName) 'job name
frm.LvChJob.Items(lstCount).SubItems.Add(Job.JobDesc) 'job description
frm.LvChJob.Items(lstCount).SubItems.Add(Job.JobComments)
frm.LvChJob.Items(lstCount).SubItems.Add(Job.JobDate) 'date or day


JoJo

After you have filled the LV add something like:

string strTest;
foreach(ListViewItem lvi in LvChJob.Items)
strTest = lvi.Text;

And step through it in the debugger, it will confirm exactly
what is in the LV.
 
Back
Top