c#代码改错

[复制链接]
查看11 | 回复3 | 2011-3-26 11:17:27 | 显示全部楼层 |阅读模式
using (StreamReader sr = new StreamReader(FileName))

{

string line;



int i;

while((line=sr.ReadLine())!= null)

{

line=line+",";


}

String[] lines = line.Split(',');

string a = lines[0].Substring(3, lines[0].Length - 3);

Label1.Text = a;}
出现错误:未将对象引用设置到对象的实例

回复

使用道具 举报

千问 | 2011-3-26 11:17:27 | 显示全部楼层
String[] lines = line.Split(',');数组没有实例化String[] lines =new lines[5]
回复

使用道具 举报

千问 | 2011-3-26 11:17:27 | 显示全部楼层
你的变量没实例化吧
回复

使用道具 举报

千问 | 2011-3-26 11:17:27 | 显示全部楼层
什么错
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行