ListView 添加项
2015-04-02 11:56:52 访问(1573) 赞(0) 踩(0)
#region ListView 添加项
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripButton_添加XML_Click(object sender, EventArgs e)
{
OpenFileDialog fd = new OpenFileDialog();
if (fd.ShowDialog() != DialogResult.OK)
return;
ListViewAddItem(fd.FileName);
}
/// <summary>
///
/// </summary>
/// <param name="fileName"></param>
protected void ListViewAddItem(string fileName)
{
FileInfo theInfo = new FileInfo(fileName);
if (!theInfo.Exists)
return;
ListView lv = listView_Main;
string[] subItem = null;
int iCount = lv.Columns.Count;
subItem = new string[iCount];
subItem[0] = theInfo.Name;
subItem[1] = theInfo.FullName;
lv.Items.Add(new ListViewItem(subItem));
}
#endregion ListView 添加项
标签:
ListView 添加项 


上一条:
下一条:
版权声明:
如果本站的资源使用了您的作品,请联系我们,我们会及时的注明
本站所有的资源均为免费自由下载,目的是让大家学习和交流
由于收集过程中几经转载,所以很多作品的原作者不详
如果您不愿在本站展示,请联系我们,我们会及时删除
相关评论
发表评论