How to get the values from ascx control to aspx page?

I'm using Microsoft Visual Studio 2005.  I'm trying get values from my user control (ascx) page to aspx (.aspx) page.  The values in the user control are the listbox controls, I would like to be able to loop thru the listbox from .aspx page to .ascx controls.

I saw some examples and try to follow the example that was posted, I got the error message of saying: "System.NullReferenceException: Object reference not set to an instance of an object."

What I have do wrong?

Here's my source code:

Protected oProductListCtl As ProductListCtl

Dim cboSelProductList As ListBox
cboSelProductList = oProductListCtl.FindControl("cboSelectedProduct")
(it failed in here:System.NullReferenceException: Object reference not set to an instance of an object.)

For i = 0 To cboSelProductList.Items.Count - 1
       sSelValue = sSelValue & cboSelProductList.Items(i).Value & ","

Your help will be greatly appreciated.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

achen30Author Commented:
sorry I post in wrong topics. This should be in
Jagadeesh MBig Data and Splunk ArchitectCommented:
>>cboSelProductList = oProductListCtl.FindControl("cboSelectedProduct")
cboSelProductList = (ProductListCtl)oProductListCtl.FindControl("cboSelectedProduct")
...not sure..though

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

achen30Author Commented:
I find out other way to work around this problem.
achen30Author Commented:
This is the way that I got around with this by using Property get and set:

Public Property ProductSelected() As String
                Dim i As Integer
                m_ProductSelected = ""
                For i = 0 To Me.cboSelectedProduct.Items.Count - 1
                    m_ProductSelected = m_ProductSelected & cboSelectedProduct.Items(i).Value & ","
                Return m_ProductSelected
            End Get
            Set(ByVal Value As String)
                m_ProductSelected = Value
            End Set
        End Property

Jagadeesh MBig Data and Splunk ArchitectCommented:
u might want to post it in the cleanup area to get a refund...
Jagadeesh MBig Data and Splunk ArchitectCommented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.