易截截图软件、单文件、免安装、纯绿色、仅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);
    


相关文档:

VB.NET/C# and JavaScript communication

Introduction
This article is about passing data between VB.NET/C# WinForms and JavaScript.
Before reading further, let me warn you that this article is not about ASP.NET. Concepts covered in the article are applied to Desktop applications.
Background
I was working on a project which required dat ......

c# xml操作

已知有一个XML文件(bookstore.xml)如下:
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="fantasy" ISBN="2-3631-4">
    <title>Oberon's Legacy</title>
    <author>Corets, Eva</author>
  &nb ......

关于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 17

五、XML模式
l  XML模式能更精确的处理XML结构约束的表示之外还为约束数据的处理提供一个XML样式。模式只是一个XML文档,受DTD的约束。对于XML模式而言,XML DTD只是一种创建文档约束的手段。因为XML模式是为了强化XML文档的有效性,它必须采用一种机制,而不是自己定义约束条件。这种机制必须是一个DTD。但是原始的D ......

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号