不太清楚你的要求,是不是像这样的呢:
Button but=new Button()
but.Click+=new System.EventHandler(this.btn_Click);
你还是想用动态的调用控件,在动态控件上加载啊,如果是这样,你可能要强制转换一下了.

解决方案 »

  1.   

    this.axEmeSmsSvr1.UserRequest += new AxEMEATLLib._IEmeSmsSvrEvents_UserRequestEventHandler(this.axEmeSmsSvr1_UserRequest);private void axEmeSmsSvr1_UserRequest(object sender, AxEMEATLLib._IEmeSmsSvrEvents_UserRequestEvent e)
    {
    string astel;
                                astel=e.evt[1];//在调试的时候可以看到e.evt[1];//,但这里这样用不行,说无法将带 [] 的索引应用于“object”类型的表达式
    this.label1.Text=astel; }
      

  2.   

    为用户控件添加事件,不知道是不是楼主想要的。
    =========================
    用户控件代码:
    using System;
    using System.Collections;
    using System.ComponentModel;
    using System.Drawing;
    using System.Data;
    using System.Windows.Forms;namespace ZZTestForm
    {
    public delegate void TextBoxChangedHandle(string message);
    /// <summary>
    /// UserControl1 的摘要说明。
    /// </summary>
    public class UserControl1 : System.Windows.Forms.UserControl
    {
    public event TextBoxChangedHandle TextBoxChanged;
    private System.Windows.Forms.TextBox textBox1;
    /// <summary> 
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public UserControl1()
    {
    InitializeComponent();
    }
    /// <summary> 
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if(components != null)
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region 组件设计器生成的代码
    /// <summary> 
    /// 设计器支持所需的方法 - 不要使用代码编辑器 
    /// 修改此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.textBox1 = new System.Windows.Forms.TextBox();
    this.SuspendLayout();
    // 
    // textBox1
    // 
    this.textBox1.Location = new System.Drawing.Point(20, 32);
    this.textBox1.Name = "textBox1";
    this.textBox1.TabIndex = 0;
    this.textBox1.Text = "textBox1";
    this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
    // 
    // UserControl1
    // 
    this.Controls.Add(this.textBox1);
    this.Name = "UserControl1";
    this.Size = new System.Drawing.Size(150, 96);
    this.ResumeLayout(false); }
    #endregion private void textBox1_TextChanged(object sender, System.EventArgs e)
    {
    TextBoxChanged(this.textBox1.Text);
    }
    }
    }
      

  3.   

    主窗体代码:
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;
    using System.Data;namespace ZZTestForm
    {
    /// <summary>
    /// Form1 的摘要说明。
    /// </summary>
    public class Form1 : System.Windows.Forms.Form
    {
    private ZZTestForm.UserControl1 userControl11;
    /// <summary>
    /// 必需的设计器变量。
    /// </summary>
    private System.ComponentModel.Container components = null; public Form1()
    {
    InitializeComponent();
    } /// <summary>
    /// 清理所有正在使用的资源。
    /// </summary>
    protected override void Dispose( bool disposing )
    {
    if( disposing )
    {
    if (components != null) 
    {
    components.Dispose();
    }
    }
    base.Dispose( disposing );
    } #region Windows 窗体设计器生成的代码
    /// <summary>
    /// 设计器支持所需的方法 - 不要使用代码编辑器修改
    /// 此方法的内容。
    /// </summary>
    private void InitializeComponent()
    {
    this.userControl11 = new ZZTestForm.UserControl1();
    this.SuspendLayout();
    // 
    // userControl11
    // 
    this.userControl11.Location = new System.Drawing.Point(96, 48);
    this.userControl11.Name = "userControl11";
    this.userControl11.Size = new System.Drawing.Size(150, 96);
    this.userControl11.TabIndex = 0;
    this.userControl11.TextBoxChanged += new ZZTestForm.TextBoxChangedHandle(this.userControl11_TextBoxChanged);
    // 
    // Form1
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
    this.ClientSize = new System.Drawing.Size(332, 217);
    this.Controls.Add(this.userControl11);
    this.Name = "Form1";
    this.Text = "Form1";
    this.ResumeLayout(false); }
    #endregion /// <summary>
    /// 应用程序的主入口点。
    /// </summary>
    [STAThread]
    static void Main() 
    {
    Application.Run(new Form1());
    } private void userControl11_TextBoxChanged(string message)
    {
    MessageBox.Show("你改变了用户控件中TextBox的值:"+message);
    } }
    }
      

  4.   

    加上ToString也不行,在调试中可以看到,贴图www.91118.com/chen/c.gif