Dim LoginControl As Login
LoginControl = CType(PreviousPage.FindControl("Login1"), Login)
If Not LoginControl Is Nothing Then
Dim UserName As TextBox
UserName = CType(LoginControl.FindControl("UserName"), TextBox)
If Not UserName Is Nothing Then
Label1.Text = UserName.Text
End If
Else
Label1.Text = "Cannot find user name in Login control."
End If