473,378 Members | 1,543 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Calling Parent Functions

I want a custom control to be able to call a function that is in it parent,
is this posible?

I have tried things like this.Parent.FunctionName();
Nov 18 '05 #1
2 1312

Yes, "Parent" should be the right way.

Maybe your Problem is that Parent returns you the Type
Windows.Forms.Control.

Simple write it this way:

dim c as Project1.MyOwnControl 'The Type of your UserControl
c = me.Parent 'Cast it to your UserControltype
c.FunctionName(); 'Call the fun

"Paul Johnson" <Pa**@pgj99.freeserve.co.uk> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP09.phx.gbl...
I want a custom control to be able to call a function that is in it parent, is this posible?

I have tried things like this.Parent.FunctionName();

Nov 18 '05 #2
I still dont understand this.

I have a aspx page called EditProperty.aspx which has a custom control
PropertyDetails.ascx.

Say in EditProperty.aspx I have a simple function like this.
void SayHi() {
Response.Write( "hi" );
}

I want to be able to call that function from within the code in
PropertyDetails.ascx. I have tried things like
void Page_Load() {
ASP.EditProperty_aspx objTheParent = (ASP.EditProperty_aspx)this.Parent;
objTheParent.SayHi();
}

But I think ASP.EditProperty_aspx can only be used in the EditProperty.aspx
class

"Captain Chaos" <no****@nospam.com> wrote in message
news:bt*************@news.t-online.com...

Yes, "Parent" should be the right way.

Maybe your Problem is that Parent returns you the Type
Windows.Forms.Control.

Simple write it this way:

dim c as Project1.MyOwnControl 'The Type of your UserControl
c = me.Parent 'Cast it to your UserControltype
c.FunctionName(); 'Call the fun

"Paul Johnson" <Pa**@pgj99.freeserve.co.uk> schrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP09.phx.gbl...
I want a custom control to be able to call a function that is in it

parent,
is this posible?

I have tried things like this.Parent.FunctionName();


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Travis Berg | last post by:
I'm running into a problem when trying to perform a callback to a Python function from a C extension. Specifically, the callback is being made by a pthread that seems to cause the problem. If I...
14
by: Michael Winter | last post by:
In an attempt to answer another question in this group, I've had to resort to calling the DOM method, Node.removeChild(), using a reference to it (long story...). That is, passing Node.removeChild....
3
by: scott | last post by:
hi all, hope some one can help me. Ill try and explain what im trying to do as best i can. i have a parent class that has a vertual function, lets call it virtual int A(). That vertual function...
2
by: Reply Via Newsgroup | last post by:
Folks, I was sure this could be done - or at least sure I had seen reference to it at some point or other - but now, after having gone for a cup of tea, am begining to doubt my original belief....
2
by: anthonyberet | last post by:
This is the first time I have tried out functions (is that the main way of making subroutines in Python?) Anyway, my function, mutate, below #make a child string by randomly changing one...
6
by: jchao123 | last post by:
Dear All, I have an MDB file (Access 2000/XP) which contains generic routines I use in various apps (eg, API calls, File access classes etc). I have compiled into an MDE file which I reference...
6
by: Jon Hyland | last post by:
Ok, I'm a little rusty on this, it should be a simple problem but I can't figure it out. How can I handle form events in my main code page?? I'm creating a Windows App in C#. Rather than make...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
12
by: Peter Cranz | last post by:
hello, I've got the following problem: I have a construct similar like this: namespace A { class X {
9
by: Cainnech | last post by:
Helo everybody, I'm having a problem with a functioncall from my iFrame. I have a page which houses an iframe. The contents of that is being generated in the script and has the following output:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.