vb.net 不熟。
像你这种情况做成一个公共的类就可以了,不需要做成用户控件吧。

解决方案 »

  1.   

    Protected ZHGBJ1 As New UserControl()
    这个定义???
    错的吧?
    一般页面只声明变量。
    如果你真的要立刻出事化,
    应该是:
    protected ZHGBJ1 as new ZHGBJ()
      

  2.   

    Dim ZHGBJ1 As New UserControl()ZHGBJ1应该有。我刚在c#中试过。
      

  3.   

    同意楼上的看法。要用Protected
    因为自定义控件拖到页面后不能被vs.net自动的初始化,所以还要用
    Protected WithEvents UserCtrl As Project.UserCtrl
    来定义。
      

  4.   

    先注册用户控件:
    <%@ Register TagPrefix="uc1" TagName="uc_foot" Src="uc_foot.ascx" %>
    使用用户控件:
    <uc1:uc_title id="Uc_title1" runat="server"></uc1:uc_title>
    在后台代码中声明该用户控件:
    public class zcfg : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Button but_cancel;
    protected wjj.uc_title Uc_title1;

    private void Page_Load(object sender, System.EventArgs e)
    {
             Uc_title1.pub();
             }
    }用户控件的代码:
    public abstract class uc_title : System.Web.UI.UserControl
    { private void Page_Load(object sender, System.EventArgs e)
    {
    // 在此处放置用户代码以初始化页面
    } public void pub()
    {
    return null;
    }
    }