---
title: ".net开发winform程序的时候，得到路径及判断路径是否合法"
author: "firefly_liu"
date: "2007-09-24T10:47:00Z"
tags: [".net", "WinForm"]
slug: "net-winform"
draft: false
lastmod: "2007-09-24T10:47:00Z"
id: 224679
url: "https://firefly-liu.iteye.com/blog/224679"
---

得到当前文件夹路径：Application.StartupPath  
得到当前程序的路径：Application.ExecutablePath  
判断路径文件是否存在：File.Exists(string path);  
判断路径文件夹是否存在：Directroy.Exists(string path);  
ListView控件设置列及行的方法：

```
lv.Columns.Add(string colName,int size,HorizontalAlignment align);

string[] vs = new string[n];
vs =
{
    value1,
    vaue2,
    .......
}
lv.Items.add(ListViewItem lvi); 
```