The Last Day Of Summer

.NET技术 C# ASP.net ActiveReport SICP 代码生成 报表应用 RDLC
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

整理一些小东西,留个备份

Posted on 2004-07-13 09:04  Cure  阅读(660)  评论(0编辑  收藏  举报

1.在winform中使用IE:
在工具箱里右击,选添加/删除选项,在弹出的对话框里选Com组件选项卡,找到Microsof Web浏览器组件,确定,
在工具箱里选择WebBrowser控件,拖放到窗体上,然后写代码:
private void button1_Click(object sender, System.EventArgs e)
{
 string str="";
 System.Object nullObject=0;
 System.Object nullObjStr=str;
 this.axWebBrowser1.Navigate("www.csdn.net",ref nullObject,ref nullObjStr,ref nullObjStr,ref nullObjStr);
   
}

2.修改xml节点值:
设xml文档为:
<test>
<name>server</name>
</test>

XmlDocument doc = new XmlDocument();
doc.Load("sample.xml");
XmlNodeList nodes = doc.GetElementsByTagName("name");
nodes[0].InnerText = "NewValue";
doc.Save("sample.xml");

3.在类被析构时向log文件中写内容:
using System;
using System.IO;
using System.Data;
namespace finalize
{
 class test
 {
  string s = "aaa";
  ~test()
  {
   StreamWriter lastGasp;
   lastGasp = File.CreateText("yourLog.log");
   lastGasp.WriteLine("it's a log" + s);
   lastGasp.Flush();
   lastGasp.Close();
  }

  [STAThread]
  static void Main(string[] args)
  {
   test t = new test();
  }
 }
}