"未将对象引用设置到对象的实例"是什么原因?
来源:互联网 发布:网络小电视浴室电视机 编辑:程序博客网 时间:2024/06/11 06:56
if (dataGridView1.Rows.Count != 0)
{
saveFileDialog1.Filter = "Execl files (*.xls)|*.xls";
saveFileDialog1.FilterIndex = 0;
saveFileDialog1.RestoreDirectory = true;
saveFileDialog1.CreatePrompt = true;
saveFileDialog1.Title = "U09D";
if (saveFileDialog1.ShowDialog() == DialogResult.OK)
{
try
{
Stream mystream = saveFileDialog1.OpenFile();
StreamWriter sw = new StreamWriter(mystream, System.Text.Encoding.GetEncoding(-0));
try
{
string str = "";
for (int i = 0; i < dataGridView1.ColumnCount; i++)
{
if (i > 0)
{
str += "/t";
}
str += dataGridView1.Columns[i].HeaderText;
}
sw.WriteLine(str);
for (int j = 0; j < dataGridView1.Rows.Count; j++)
{
string tempstr = "";
for (int K = 0; K < dataGridView1.Columns.Count; K++)
{
if (K > 0)
{
tempstr += "/t";
}
tempstr += dataGridView1.Rows[j].Cells[K].Value.ToString();
}
sw.WriteLine(tempstr);
}
sw.Flush();
sw.Close();
mystream.Close();
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString(), "警告");
}
finally
{
sw.Flush();
sw.Close();
mystream.Close();
}
}
catch (Exception ee)
{
MessageBox.Show(ee.ToString());
}
}
小弟实在看不出以上代码中哪里没实例化T-T
- "未将对象引用设置到对象的实例"是什么原因?
- 在发布网站后,出现“未将对象引用设置到对象的实例”的错误时,是什么原因?
- 未将对象引用设置到对象的实例"
- 未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例
- session未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例
- ConfigurationManager:未将对象引用设置到对象的实例。
- 未将对象引用设置到对象的实例 解决办法
- 未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例 原因
- 未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例
- ConfigurationManager:未将对象引用设置到对象的实例
- 未将对象引用设置到对象的实例
- 二级指针和指针的引用之间的区别
- MFC的消息反射机制
- 酷壳上的一段js代码分析
- 在Emacs中漫游——sydict v0.3
- 懒人日志:小说批量重命名。。。
- "未将对象引用设置到对象的实例"是什么原因?
- java获取以时间为种子的随机数
- 驴子与小狗
- c# 添加 infer.net 库
- 风与太阳
- qt for android
- 学习笔记 --泛型
- 树和斧子
- android UI进阶之style和theme的使用