int i = 0;
foreach(ListViewItem myView in this.lvBody.Items)
{
if(this.lvBody.Items[i].Selected == true)
{
DoSomething;
}
}
But you can interchange lvBody with myView with the syntax
myView.ListViewItem and treat it as normal
Hope that helps a bit
MikeY
"TheSteph" <Th******@NoSpam.com> wrote in message
news:uw**************@TK2MSFTNGP03.phx.gbl...
Any way to find the Clicked SubItem in a ListView ?
private int GetSubItemAtPos(ListView AListView, Point APoint)
{
int PositionCounter = 0;
int TmpRelativeColIndex = -1;
//Browse All Column by DISPLAYED INDEX
for (int ColDisplayCount = 0; ColDisplayCount < AListView.Columns.Count;
ColDisplayCount++)
{
//Find ColumnIndex relative to the current ColDisplayCount
TmpRelativeColIndex = -1;
for (int ColIndexCount = 0; ColIndexCount <
AListView.Columns.Count;
ColIndexCount++)
{
if (AListView.Columns[ColIndexCount].DisplayIndex ==
ColDisplayCount)
{
TmpRelativeColIndex = ColIndexCount;
break;
}
}
//if a TmpRelativeColIndex has been found, check if X pos is now
inside new bounds
if (TmpRelativeColIndex > -1)
{
//Incremental end position
PositionCounter +=
AListView.Columns[TmpRelativeColIndex].Width;
//chec if X pos is inside bounds
if (APoint.X < PositionCounter) return TmpRelativeColIndex;
}
}
return -1;
}
steph.