Treeview怎么动态为父节点添加子节点
#regionMySQLControlData_mydata=newMySQLControlData();IList_myfgroup=newArrayList();_m...
#region
MySQLControlData _mydata = new MySQLControlData();
IList _myfgroup = new ArrayList();
_myfgroup = Public._sys.GetFGroutList();
//_myfgroup = _mydata.GetFriendList(" and uid=" + Public.UserLogonInfo.U_SnsId, "8", out _fuids);
//this.label1.Text += "下面是我的好友列表:\r\n";
tv_flist.BeginUpdate();
tv_flist.Nodes.Clear();
//tv_flist.Nodes.Add(_mydata.GetfGroupName(_mf.gid));
for (int i = 0; i < _myfgroup.Count; i++)
{
TreeNode tn; //建立treeview的节点
tn = new TreeNode(_myfgroup[i].ToString());
tv_flist.Nodes.Add(tn);
#region 增加二级节点
IList _myflist = new ArrayList();//好友列表
_myflist = Public._sys.GetFriendList(i.ToString(), Public.UserLogonInfo.U_SnsId.ToString());
for (int k = 0; k < _myflist.Count; k++)
{
CMS_Friend _mf = new CMS_Friend();
_mf = (CMS_Friend)_myflist[i];
//增加二级节点
TreeNode child = new TreeNode();
}
#endregion
}
tv_flist.EndUpdate();
#endregion 展开
MySQLControlData _mydata = new MySQLControlData();
IList _myfgroup = new ArrayList();
_myfgroup = Public._sys.GetFGroutList();
//_myfgroup = _mydata.GetFriendList(" and uid=" + Public.UserLogonInfo.U_SnsId, "8", out _fuids);
//this.label1.Text += "下面是我的好友列表:\r\n";
tv_flist.BeginUpdate();
tv_flist.Nodes.Clear();
//tv_flist.Nodes.Add(_mydata.GetfGroupName(_mf.gid));
for (int i = 0; i < _myfgroup.Count; i++)
{
TreeNode tn; //建立treeview的节点
tn = new TreeNode(_myfgroup[i].ToString());
tv_flist.Nodes.Add(tn);
#region 增加二级节点
IList _myflist = new ArrayList();//好友列表
_myflist = Public._sys.GetFriendList(i.ToString(), Public.UserLogonInfo.U_SnsId.ToString());
for (int k = 0; k < _myflist.Count; k++)
{
CMS_Friend _mf = new CMS_Friend();
_mf = (CMS_Friend)_myflist[i];
//增加二级节点
TreeNode child = new TreeNode();
}
#endregion
}
tv_flist.EndUpdate();
#endregion 展开
1个回答
启帆信息
2024-11-19 广告
2024-11-19 广告
启帆信息是英伟达中国区代理商,原厂授权代理,提供全面的软件技术解决方案以及NVIDIA以太网产品、交换机等产品,欢迎前来咨询!...
点击进入详情页
本回答由启帆信息提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询