用public property objConn()
在get里面写你的连接代码!

解决方案 »

  1.   

    public string ConnectionString
    {
      get { return strConn; }
      set { strConn = value; }
    }
      

  2.   

    public string A="";public string a
    {
      set
        {
           A=value;
         }
      get
        {
           return A;
        }
    }
      

  3.   

    但是当我将这个控件加到其他网页中的时候,它的属性只有viewstate,visible,id,没有我自己定义的属性设置,怎么办?
      

  4.   

    我定义的如下:
     Private _Connection As New SqlConnection("User id=sa;Pwd=ww;initial catalog=haiermanage;Data Source=localhost")
            Private _EstradeName As String = "A-1"
            Private _TestAddress As String = "黄岛中一"
            Private _WorkMan As String = "戴宁"
            Public Property Connection() As SqlConnection
                Get
                    Return _Connection
                End Get
                Set(ByVal Value As SqlConnection)
                    _Connection = Value
                End Set
            End Property
            Public Property EstradeName() As String
                Get
                    Return _EstradeName
                End Get
                Set(ByVal Value As String)
                    _EstradeName = Value
                End Set
            End Property
            Public Property TestAddress() As String
                Get
                    Return _TestAddress
                End Get
                Set(ByVal Value As String)
                    _TestAddress = Value
                End Set
            End Property
            Public Property WorkMan() As String
                Get
                    Return _WorkMan
                End Get
                Set(ByVal Value As String)
                    _WorkMan = Value
                End Set
            End Property
    但是在属性框中看不到这些属性
      

  5.   

    public _Connection As New SqlConnection("User id=sa;Pwd=ww;initial catalog=haiermanage;Data Source=localhost")
      

  6.   

    you property must use the public type,that you can see.
      

  7.   

    但是我的控件的属性已经是public了,为什么还不行?