hi all
i have errors while bulding the code in c#
Code:
private void subMenuModify_Click(object sender, System.EventArgs e)
{
int nStart = X;
int spos = 0;
int epos = this.lvFiles.Columns[0].Width;
for (int i = 0; i < this.lvFiles.Columns.Count; i++)
{
if (nStart > spos && nStart < epos)
{
subItemSelected = i;
break;
}
spos = epos;
epos += this.lvFiles.Columns[i].Width;
}
subItemText = this.lvItem.SubItems[2].Text;
the line at which exception occurs is subItemText = this.lvItem.SubItems[2].Text;
the exception is as follows:
Nullreference exception was unhandled
Object reference not set to an instance of an object.
Pls anyone help me resolve this issue?