易截截图软件、单文件、免安装、纯绿色、仅160KB

c#:Dataset读取XML文件动态生成菜单

Step 1:Form1 上添加一个ToolStripContainer控件
Step2:实现代码
private void Form2_Load(object sender, EventArgs e)
{
    CMenuEx menu = new CMenuEx();
    string sPath = "D:\\Menu.xml";//xml的内容
     if (menu.FileExit())
    { 
             menu.LoadAllMenu(sPath, toolStripContainer1);
     }
     else
     { MessageBox.Show("XML文件加载失败!"); }
}
/// <summary>
/// 菜单读取类
/// </summary>
public class CMenuEx
{
    private string _Path;
    /// <summary>
    /// 设置XML配置文件路径
    /// </summary>
    public string Path
    {
        get { return _Path; }
        set { _Path = value; }
    }
    /// <summary>
    /// 判断文件是否存在
    /// </summary>
    /// <returns>文件是否存在</returns>
    public bool FileExit()
    {
        if (File.Exists(_Path))
        { return true; }
        else return false;
    }
    /// <summary>
    /// 加载菜单
    /// </summary>
    /// <param name="menuStrip">母菜单对象</param>
    public void LoadAllMenu(string sXmlPath, ToolStripContainer pToolStripContainer)
    {
        DataSet ds = new DataSet();
        ds.ReadXml(sXmlPath, XmlReadMode.Auto);
    


相关文档:

Sqlite在C#中的应用

在 .NET 里面使用 SQLite, 我这里使用的wrapper是 System.Data.SQLite,它只需要一个dll,接口符合ADO.Net 2.0的定义,性能也不错,NHibernate用的也是它,目前支持ADO.NET 3.5了,支持集成在 VS2005 和 VS2008里面,而且支持wince,是个亮点
因为符合ADO.NET的规范,所以使用方式,基本和 SqlClient, OleDb等原生的一致
us ......

关于xml删除节点的问题

前面文章中提到 xml节点的删除
“删除 <book genre="fantasy" ISBN="2-3631-4">节点的genre属性,删除 <book genre="update陶维佳" ISBN="2-3631-4">节点。”
代码: 
 XmlNodeList xnl=xmlDoc.SelectSingleNode("bookstore").ChildNodes; 
  foreach(XmlNode&nbs ......

Java and XML_读书笔记_2010 05 16

2010-05-16
三、解析XML文档
l  Xerces解析器、SAX类和接口
l  SAX阅读器
n  首先要得到一个符合SAX org.xml.sax.XMLReader接口规范的例子,这个接口定义了解析行为并允许设置某些特征和属性。该接口替换了SAX1.0中的org.xml.sax.Parser
import org.apache.xerces.parsers.SAXParser;
import org.xml. ......

Loading XML data using ActionScript 3.0

Loading XML data using ActionScript 3.0
By Blue_Chi | Flash CS3 | ActionScript 3.0 | Beginner
Using XML is one of the best ways for structuring external content in a logical format that is easy to understand, process, and update. This tutorial will teach you the basics on how to load and process X ......

c#从html中获取图片地址

 
using System.Text.RegularExpressions;
string ohtml = this.TextBox1.Text;
            System.Text.RegularExpressions.MatchCollection m;
            //提取字符串的图片
   ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号