473,799 Members | 3,276 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

i want to access the parent control in the constructor

hi guys, its me again, with a few simple (probably silly) quesetion...

hi guys, i've managed to create a custom textbox class.
& i'd like to access the parent control (in this case this would be the
form, cuz i drop the textbox onto the form), in the constructor of the
custom textbox class.

i'd like to access the parent control in the constructur of the textbox.
But i can't do this, cuz i get an error, saying that the parent property is
not initialized.
Error Message = Additional information: Object reference not set to an
instance of an object

But once the control is instantiated, i can access use this property to
access the parent object.

How can i access the parent object, in the constructor of my user control???

Nov 21 '05 #1
3 1847
Hi,

You do not have access to the controls parent until the
parentchanged event is fired.

Ken
----------------------
"Antuane" <An*****@testin g.com.net> wrote in message
news:eu******** ******@TK2MSFTN GP15.phx.gbl...
hi guys, its me again, with a few simple (probably silly) quesetion...

hi guys, i've managed to create a custom textbox class.
& i'd like to access the parent control (in this case this would be the
form, cuz i drop the textbox onto the form), in the constructor of the
custom textbox class.

i'd like to access the parent control in the constructur of the textbox.
But i can't do this, cuz i get an error, saying that the parent property is
not initialized.
Error Message = Additional information: Object reference not set to an
instance of an object

But once the control is instantiated, i can access use this property to
access the parent object.

How can i access the parent object, in the constructor of my user control???


Nov 21 '05 #2
thanx
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

You do not have access to the controls parent until the
parentchanged event is fired.

Ken
----------------------
"Antuane" <An*****@testin g.com.net> wrote in message
news:eu******** ******@TK2MSFTN GP15.phx.gbl...
hi guys, its me again, with a few simple (probably silly) quesetion...

hi guys, i've managed to create a custom textbox class.
& i'd like to access the parent control (in this case this would be the
form, cuz i drop the textbox onto the form), in the constructor of the
custom textbox class.

i'd like to access the parent control in the constructur of the textbox.
But i can't do this, cuz i get an error, saying that the parent property is not initialized.
Error Message = Additional information: Object reference not set to an
instance of an object

But once the control is instantiated, i can access use this property to
access the parent object.

How can i access the parent object, in the constructor of my user control???

Nov 21 '05 #3
also, i managed to use the OnCreateControl () method of the baseclass for
this.
"Ken Tucker [MVP]" <vb***@bellsout h.net> wrote in message
news:eP******** ******@TK2MSFTN GP09.phx.gbl...
Hi,

You do not have access to the controls parent until the
parentchanged event is fired.

Ken
----------------------
"Antuane" <An*****@testin g.com.net> wrote in message
news:eu******** ******@TK2MSFTN GP15.phx.gbl...
hi guys, its me again, with a few simple (probably silly) quesetion...

hi guys, i've managed to create a custom textbox class.
& i'd like to access the parent control (in this case this would be the
form, cuz i drop the textbox onto the form), in the constructor of the
custom textbox class.

i'd like to access the parent control in the constructur of the textbox.
But i can't do this, cuz i get an error, saying that the parent property is not initialized.
Error Message = Additional information: Object reference not set to an
instance of an object

But once the control is instantiated, i can access use this property to
access the parent object.

How can i access the parent object, in the constructor of my user control???

Nov 21 '05 #4

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

Similar topics

5
3654
by: Suzanne Vogel | last post by:
Hi, Given: I have a class with protected or private data members, some of them without accessor methods. It's someone else's class, so I can't change it. (eg, I can't add accessor methods to the parent class, and I can't make some "helper" class a friend of the parent class to help in accessing the data.) Problem: I want to derive a class that has a copy constructor that properly copies those data members.
3
5939
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be terminated by pressing ++ and then terminate the process. I searched the entire internet and found out that there could be two things wrong (both of them are mentioned in the bug list on the access
8
3365
by: deko | last post by:
I'm hoping someone can sanity check my understanding of the Object Model for Forms/Controls. I'm having trouble drilling down into Control properties. First, I have a record set with the following for a given Form: 1)Container
3
3947
by: Omar Llanos | last post by:
I have Form1 and Form2 (which is inherited from Form1), and I created a button in Form2 that will fill up a textbox in Form1. What code would do that? I tried the simplest way: //from child form in button2 clicked event: textbox1.Text = "Hello";
3
1875
by: Ray Mitchell | last post by:
Hello, I am opening a modal dialog in the standard way using something like: ....all the standard setup stuff... dlg.ShowDialog(); I need the dialog object to be able to access some of the methods back in the object that created it (the code above). Is there some attribute, method, or whatever within the dialog object that provides such access or do
6
6082
by: reandeau | last post by:
I'm building out a OO based app in PHP 5 but I'm getting a little confused on children contructing parents. I have a parent that looks like this: abstract Class State { protected $database; protected $user; protected $output; public function __construct($database,$user,$output) { $this->database = $database;
1
1502
by: Charles Zhang | last post by:
I created a custom server control that derives from WebControl. I found Parent and Page property are null for the control I created. But Parent is a readonly property so that I have no way to assign it a proper value. By the way, I did no create a constructor for my custom control. I did not override OnInit() method as well. Could some one point out what I am doing wrong.
0
3450
Shashi Sadasivan
by: Shashi Sadasivan | last post by:
Hi, i created this user control, which has the ability to open forms. However these forms are to be opened as MDI Children and i am passing the form object which contains this usercontrol, so that its parent which is the MDI Form will be assigned to any of the forms opened by this control. So i was passing it using the constructor,, and to make it behave properly in VS i had to get into the designer.cs in the VS generated code and change...
2
3220
by: Harris Kosmidhs | last post by:
Hello, I have an AppController and some classes that extend the controller. I.e: class UsersController extends AppController { function UsersController() { parent::AppController();
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.