LISTVIEW 访问子项的问题 急急

sh_liyu98 2006-04-21 11:44:15

我现在用C#开发WINDOWS CE的应用程序,其中不能使用Items[n]的方式去访问他相关的子项,不知道下面的程序在哪个方面出了问题 请高手指点,小弟刚刚开始学习C#

int nRows = this.m_ListUserInfo.Items.Count;



// if(this.m_ListUserInfo.Items.GetEnumerator() == null)
// this.m_UserName.Text = "NULL";

this.m_ListUserInfo.Items.GetEnumerator().Reset();
// this.m_ListUserInfo.Items.GetEnumerator().Current;
string strItemValue;
this.m_ListUserInfo.Items.GetEnumerator().
while (this.m_ListUserInfo.Items.GetEnumerator().MoveNext())
{
ListViewItem lvi = (ListViewItem)this.m_ListUserInfo.Items.GetEnumerator().Current;
strItemValue = lvi.SubItems[1].ToString();
if(strItemValue.CompareTo(this.m_UserName.Text) >=0)
{

//int nIndex = this.m_ListUserInfo.Items.IndexOf(lvi);
// this.m_ListUserInfo.EnsureVisible(nIndex);
//lvi.Selected = true;
//lvi.Checked = true;
break;
}

}
...全文
135 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
Yellow198267 2006-04-29
  • 打赏
  • 举报
回复
if("item[i].subitem[1]'第一个子项")
{
?????????????????????this.listview1.item[i].subitem[0]??????????????????
}
??????????????????????????????????????
alex260 2006-04-29
  • 打赏
  • 举报
回复
我也正在开发这样的程序,没有高手知道吗?
alex260 2006-04-29
  • 打赏
  • 举报
回复
没人告诉,自己调通了,代码写的效率很差,欢迎老鸟指正。
IEnumerator selCol = listView2.SelectedIndices.GetEnumerator();
selCol.MoveNext() ;
string str = selCol.Current.ToString();
int i = Int16.Parse(str);
shared_file_name = listView2.Items[i].SubItems[0].Text;
shared_file_size = listView2.Items[i].SubItems[1].Text;
shared_file_path = listView2.Items[i].SubItems[2].Text;
zhaoliang_chen 2006-04-21
  • 打赏
  • 举报
回复
索引器
sh_liyu98 2006-04-21
  • 打赏
  • 举报
回复
这个函数不能使用 因为我只能使用.NET精简版本
copico 2006-04-21
  • 打赏
  • 举报
回复
item[i].subitem[1]'第一个子项

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧