Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Property in control

Status
Not open for further replies.

HotBob

Programmer
May 26, 2006
37
GB
Hi there I have a control called Search and in that control I have a property such as:

Code:
    Dim _Source As String
    Public Property Source() As String
        Get
            Return _Source
        End Get
        Set(ByVal Value As String)
            _Source = Value
        End Set
    End Property


In my main page I first have to reference the control

Public search1 As New Search

Then in my page load event I want to set the property, such as

Code:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        search1.source = "../MyPage.aspx"
End Sub

However the property doesn't hold the value so the return value is empty. Any ideas?
 
Did you drag and drop the control from the solution explorer to the form?
 
Yes I did.

It recognises the fact that there is a control. But when I use

search1.source = "../MyPage.aspx"

The property doesn't hold the value

So the return is always nothing.

Any ideas?
 
If you put in a button: Response.Write(me.search1.source) what happens when you press it?
 
>>How are you trying to access the property once you set it?

exactly, are you doing a postback and checking the value???

Known is handfull, Unknown is worldfull
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top