accessing a user control

Gertie

Active member
Joined
May 8, 2003
Messages
25
Location
Belgium
Hello,

I have a usercontrol. In it is a string declared.

Now for me a simple question, but not easy to find an answer on the net: Can i get the value of this string to a new string in the form that has the ascx file implemented on it?

thanks a lot, Gertie
 
ok, so far

so far all i came up with is making a function in the user control named GiveUser that returns the string.

Then i made following changes in my form.
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
Dim hoofding As Control = Page.FindControl("Hoofding")
Dim hoofdingType As Type = hoofding.GetType
Dim hoofdingGetUser As PropertyInfo = hoofdingType.GetProperty("GiveUser")
strUser = hoofdingGetUser.GetValue(hoofding, Nothing).ToString()

If strUser = "" Then
pnlLogIn.Visible = False
pnlLogOut.Visible = True
Else
pnlLogIn.Visible = True
pnlLogOut.Visible = False
End If
End Sub

thanks, guys for any help on this
 
Back
Top