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


相关文档:

sqlserver FOR XML PATH 语句的应用

代码如下:

DECLARE
@TempTable table(UserID int , UserName nvarchar(50));
insert into
@TempTable (UserID,UserName) values (1,'a')
insert into @TempTable
(UserID,UserName) values (2,'b')

select UserID,UserName
from @TempTable FOR XML PATH
运行这段脚本,将生成如下结果:
复制代码 ......

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#关键字:访问关键字(access keyword)

 C#中访问关键字(access keyword)有两个:base、this
 
1.base
   用于从派生类中访问基类的成员,包括:
     a.调用基类上已被其它方法重写(override)的方法。
     b.指定创建派生类实例时应调用的基类构造函数。
  注意:对基类的访问只能 ......

asp.net(C#) 数据库备份还原 源码

Backup.aspx
  protected void Button1_Click(object sender, EventArgs e)
    {
        string path = Server.MapPath("") + @"\Backup";
        if (!Directory.Exists(path))
       ......

js C# ASP.Net 正则去掉超链接(只是 和 )

//替换所有
Regex reg = new Regex(@"(?is)</?a\b[^>]*>(?:(?!</?a).)*</a>");
string result = reg.Replace(yourStr, "");
//保留www.abc.com链接
Regex reg = new Regex(@"(?is)</?a\b.*?href=(['""]?)(?!(?:http://)?www\.abc\.com)[^'""\s>]+\1[^>]*>(?<text>(?:(?!</?a).) ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号