473,383 Members | 1,815 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,383 software developers and data experts.

Finding Out Parent Control

How do you find out the name of the parant control of the control you
are working working with

I have try

me.parent.name.tostring() ..... etc

any help would be great ta
Dec 17 '07 #1
2 5331
Barkingmadscot wrote:
How do you find out the name of the parant control of the control you
are working working with
"Working with" at what point?
I have try
me.parent.name.tostring() ..... etc
Unless you're deriving your own Control classes, "Me" should refer to
the Class (i.e. Form) in which you're working which, hopefully, won't
/have/ a Parent Control.

Inside, say, a Control's Event Handler, you'd use:

Private Sub XYZ_Ev( ByVal sender as Object, ByVal e As EventArgs ) _
Handles XYZ.Ev [, ...]

If TypeOf sender Is Control Then
Dim parent As Control _
= DirectCast( sender, Control ).Parent

If parent IsNot Nothing Then
. . .
End If
End If
End Sub

HTH,
Phill W.
Dec 17 '07 #2
"Barkingmadscot" <ba***@bcc-it.co.ukschrieb:
How do you find out the name of the parant control of the control you
are working working with

I have try

me.parent.name.tostring() ..... etc

any help would be great ta
Without error checking:

\\\
MsgBox(Me.ActiveControl.Parent.Name)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Dec 17 '07 #3

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

Similar topics

2
by: dinoo | last post by:
Some one help me out. I have a windows form.I added Panel to a windows form. I put a textbox in a Panel. When ever I try to get Parent of textbox. its always returns me the handle of Form not...
0
by: Adrien Treccani | last post by:
Hello, I need a toolTip control that allows me to change the fore color, back color etc. I've tried to inherit a class from the ToolTip one to be able to draw what I needed : it isn't possible....
2
by: David K. | last post by:
My question concerns C# Windows Forms user controls. I have created navigation user control. It gets the parent control's CurrencyManager to its bindable property. In the control, any change in...
3
by: David K. | last post by:
My question concerns C# Windows Forms user controls. I have created navigation user control. It gets the consumer application parent control's (a Form) CurrencyManager to its bindable property. In...
0
by: ab_j | last post by:
I have a user control that contains a dropdown which I want to use as a menu on multiple .aspx pages. Basically, all I am trying to do is pass the selected value of the dropdown in the user...
5
by: Steve Richter | last post by:
In my user control I want to read the ViewState dictionary of the Parent control. But this sensible idea is not permitted by the compiler: Compiler Error Message: CS1540: Cannot access...
3
by: Antuane | last post by:
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...
2
by: Joe | last post by:
Hello all, When I drop a control (say a Button) on my user control, the button is added to the parent control of my user control and not my control. For example if my user control is on a panel...
3
by: mroffey | last post by:
Hi everyone, I've been having this problem and I've searched high and low, but I can't seem to find the answer to what is probably a very simple solution. In a nutshell, I have a nested...
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: 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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.