Call a sub from 1 usercontrol to another.

J

Jay

Guys, I'm stuck!!!

I have two usercontrosl, in UC2 I had a public sub which I want to call
from UC1. Both UC's are on the same aspx page.

In UC1 I have teh following line at the top of the ascx:

Protected WithEvents ucPdqmBasketMini As pdqmBasketMini

IN UC2 the sub looks like:

Public Sub pdqmAddItem(ByVal intProdID As Int32)
lblTotal.Text = "add item " & intProdID
End Sub

The lblTotal label is member of the .aspx/vb page.

When I call the Sub from UC1 with the following:

ucPdqmBasketMini.pdqmAddItem(intProdID)

I get the error:

Object reference not set to an instance of an object.

So thinking UC1 cannot see UC2 I added the following declaration in the
ascx of UC1:

<%@ Register TagPrefix="uc1" TagName="pdqmBasketMini"
Src="pdqmBasketMini.ascx" %>

Still no joy. Any ideas what I am doing wrong?
 
J

Jay

In addition, when I call the sub the aspx.vb which has both UC's
registered, there's no problem at all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top