public sub (on master page) not visible after upgrade form 2.0 2005to 2008 3.5

N

NotTooSerious

Hi I have just upgraded a project from 2005 net 2.0 frame work to 2008
net 3.5 frame work
On the (single not nested) master page I have a lable which is wrapped
in a public sub to set its text and fore colour
The content pages which inherit from the master page do not now see
the public sub and give a compile error

I've deleted the sub saving the project and adding the public sub back
again - no joy

How do I declare a sub of a master page which is visible to the conten
pages please?
 
F

Fernando Rodriguez

I may be confused, but Content pages do not inherit from Master pages, not
even in 2.0. To access a method on the master page from you content page you
need to do use the Master property on the content page, which will return an
instance of your master page that you need to cast to the actual type of
your master page before you can call the method (actually VB may let you
call it without casting but in order to see it on intellisense you need to
cast it as follows:

If TypeOf Me.Page.Master Is MyMasterPageType Then

CType(Me.Page.Master, MyMasterPageType).MyPublicMethod()
End If

If that's not what you're trying to do please post some code samples so I
can get a better idea.

Hope that helps,
Fernando Rodriguez
 
E

Ex glider pilot

I may be confused, but Content pages do not inherit from Master pages, not
even in 2.0. To access a method on the master page from you content page you
need to do use the Master property on the content page, which will return an
instance of your master page that you need to cast to the actual type of
your master page before you can call the method (actually VB may let you
call it without casting but in order to see it on intellisense you need to
cast it as follows:

If TypeOf Me.Page.Master Is MyMasterPageType Then

    CType(Me.Page.Master, MyMasterPageType).MyPublicMethod()
End If

If that's not what you're trying to do please post some code samples so I
can get a better idea.

Hope that helps,
Fernando Rodriguez








- Show quoted text -
 

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,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top