按行读取文件: int filecount=0; // open the file just specified such that no one else can use it. streamreader sr = new streamreader(textbox1.text.trim()); while(sr.peek() > -1)//streamreader.peek()返回下一个可用字符,但不使用它 { listbox1.items.add(sr.readline()); filecount++; } sr.close();