写在毕业后4个月

今天是8月31日,8月的最后一天,在往年的这个时候我都在准备开学或者已经开学。今年完全不同了,再也没有一点学生的感觉。
今天是我这次出差回来第一天到公司上网,这次出差是我人生中出差最长的一次了,45天,在这45天的时间里,我收获也很多,这段时光将是我非常难忘的一段时光。45天的时间是我完全蜕变成了一名社会职业人,学生的时代一去不复返了。
到今天,我已经正式工作4个月了,时间过得非常快,转眼间将会送走2011年,不要懈怠每一天的时光,认真对待每天,三省吾身,争取一天一点点进步!

ConfigurationSettings.AppSettings

在VS 2003转换2005时,项目里会出现原来2003里过时的配置文件引用的类,如下:
System.Configuration.ConfigurationSettings.AppSettings 已过时 警告:"System.Configuration.ConfigurationSettings.AppSettings”已过时:“This method is obsolete, it has been replaced by System.Configuration!System.Configuration.ConfigurationManager.AppSettings”

注意:默认没有引用ConfigurationManager类,所以找不到System.Configuration命名空间的 ConfigurationManager类。
解决:
首先,添加对System.Configuration.dll 文件的引用;
其次,再将"System.Configuration.ConfigurationSettings.GetConfig替换为System.Configuration.ConfigurationManager.GetSection;
最后,将“System.Configuration.ConfigurationSettings.AppSettings”替换为System.Configuration.ConfigurationManager.AppSettings”。

2011年6月5日达到甘肃省嘉峪关市

下午6点准时到达嘉峪关,此次项目为酒泉钢铁动态轨道衡精度研究。先上几张今天刚到拍的照片吧。
下了火车,第一感觉就是空气太好了,好久没有感受过这样的空气了,蓝天白云,别有风味。
这个城市非常干净,一尘不染。
这里很有特色的就是跟山东有将近两个小时的时差,现在是9点半了,这里刚刚天黑,有点不适应,呵呵。
5.png4.png3.png2.png1.png

vs2005的工程用vs2010打开后用vs2005不能打开了

首先,在“项目”菜单里,把项目属性“目标平台”改为框架2.0,保存退出。
然后,用记事本或用编辑文本文件的方式打开你的项目文件,后缀为.sln
第一行:把“Microsoft Visual Studio Solution File, Format Version 11.00”
改为“Microsoft Visual Studio Solution File, Format Version 9.00”
第二行:把“# Visual Studio 2010"
改为“# Visual Studio 2005"
就行了

WinForm下DataGridView导出Excel的实现(简单无错版,带另存对话框)

private void ExportExcel(string fileName, DataGridView myDGV)
{
string saveFileName = "";
SaveFileDialog saveDialog = new SaveFileDialog();
saveDialog.DefaultExt = "xls";
saveDialog.Filter = "Excel文件|*.xls";
saveDialog.FileName = fileName;
saveDialog.ShowDialog();
saveFileName = saveDialog.FileName;
if (saveFileName.IndexOf(":") < 0) return; //被点了取消
Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application();
if (xlApp == null)
{
MessageBox.Show("无法创建Excel对象,可能您的机子未安装Excel");
return;
}

Microsoft.Office.Interop.Excel.Workbooks workbooks = xlApp.Workbooks;
Microsoft.Office.Interop.Excel.Workbook workbook = workbooks.Add(Microsoft.Office.Interop.Excel.XlWBATemplate.xlWBATWorksheet);
Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets[1];//取得sheet1

//写入标题
for (int i = 0; i < myDGV.ColumnCount; i++)
{
worksheet.Cells[1, i + 1] = myDGV.Columns[i].HeaderText;
}
//写入数值
for (int r = 0; r < myDGV.Rows.Count; r++)
{
for (int i = 0; i < myDGV.ColumnCount; i++)
{
worksheet.Cells[r + 2, i + 1] = myDGV.Rows[r].Cells[i].Value;
}
System.Windows.Forms.Application.DoEvents();
}
worksheet.Columns.EntireColumn.AutoFit();//列宽自适应
if (saveFileName != "")
{
try
{
workbook.Saved = true;
workbook.SaveCopyAs(saveFileName);
}
catch (Exception ex)
{
MessageBox.Show("导出文件时出错,文件可能正被打开!\n" + ex.Message);
}

}
xlApp.Quit();
GC.Collect();//强行销毁
MessageBox.Show(fileName + "保存成功", "提示", MessageBoxButtons.OK);
}