1 为避免header()函数是,出现 <b>Warning</b>: Cannot modify header information - headers already sent by (output started at /var/www/test.php:5) in <b>/var/www/test.php</b> on line <b>6</b><br /> 错误,我们可以在进行header()导向跳转时,使用
public static class ComponentHelper<T> where T : Control { public static bool HaveEventHandler(T control, string eventName, string methodName) { //获取Button类定义的所有事件的信息 PropertyInfo pi = (typeof(T)).GetProperty("Events", BindingFlags.Instanc
我们开发WinFrom程序,很多时候都希望程序只有一个实例在运行,避免运行多个同样的程序,一是没有意义,二是容易出错. 为了更便于使用,笔者整理了一段自己用的代码,可以判断程序是否在运行,只运行一个实例,而且能实现当程序在运行时,再去双击程序图标,直接呼出已经运行的程序. 下面看代码,只需在程序的入口文件中加如下代码即可: static class Program { /// <summary> /// 应用程序的主入口点. /// </summary> [STAThread] s
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; using System.Net; namespace Client { static class Program { /// <summary> /// 应用程序的主入口点. /// </summary>