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

How identify active control name

I know that I can do the following to identify the parent name of an active
control

Dim sParentName As String = ActiveControl.Parent.Name

But how do I identify the name of the active control?

Str = activeControl.Name

does not seem to work.


Nov 20 '05 #1
6 17312
it's should work. post your code snippet if you can't get it work.

Rajesh Patel

"Woody Splawn" <wo***@splawns.com> wrote in message
news:uK**************@tk2msftngp13.phx.gbl...
I know that I can do the following to identify the parent name of an active control

Dim sParentName As String = ActiveControl.Parent.Name

But how do I identify the name of the active control?

Str = activeControl.Name

does not seem to work.

Nov 20 '05 #2
* "Woody Splawn" <wo***@splawns.com> scripsit:
I know that I can do the following to identify the parent name of an active
control

Dim sParentName As String = ActiveControl.Parent.Name

But how do I identify the name of the active control?

Str = activeControl.Name

does not seem to work.


Why doesn't it work? Error message?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
I'm sorry, I gave you incorrect information. It does work when I use it,
for example, on a txtbox on a field on a winform but I am trying to make it
work for a field on a datagrid. That is, I am on a datagrid and I would
like to identify the field on the datagrid that I am on. I assume that is
considered by VS as the ActiveControl. My intent is to leave it and then
return to it. When I use code like the following under those circumstances
I get a result of nothing.

Str = activeControl.Name

Dim sParentName As String = ActiveControl.Parent.Name gives me the name of
the datagrid but I would like the field on the datagrid that I am currently
on.

Thank you in advance for your help.



Nov 20 '05 #4
Hi Woody,

Based on my understanding ,you want to know what field is the cell you are
selecting in.
I think you may try to get it from the datasouce. e.g. it is a dataset

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DataGrid1.CurrentCellChanged

MsgBox(DataSet11.Tables(0).Columns(DataGrid1.Curre ntCell.ColumnNumber).Colum
nName)
End Sub

Did I misunderstand you meaning?
If you have related question, please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
From: "Woody Splawn" <wo***@splawns.com>
References: <uK**************@tk2msftngp13.phx.gbl> <bm************@ID-208219.news.uni-berlin.de>Subject: Re: How identify active control name
Date: Mon, 13 Oct 2003 15:13:45 -0700
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <u9**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.surewest.net 66.60.158.168
Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:146430
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I'm sorry, I gave you incorrect information. It does work when I use it,
for example, on a txtbox on a field on a winform but I am trying to make it
work for a field on a datagrid. That is, I am on a datagrid and I would
like to identify the field on the datagrid that I am on. I assume that is
considered by VS as the ActiveControl. My intent is to leave it and then
return to it. When I use code like the following under those circumstances
I get a result of nothing.

Str = activeControl.Name

Dim sParentName As String = ActiveControl.Parent.Name gives me the name of
the datagrid but I would like the field on the datagrid that I am currently
on.

Thank you in advance for your help.




Nov 20 '05 #5
Are you the Peter Huang of the Sacramento Calif area?
Nov 20 '05 #6
Hi Woody,

Did my suggestion works for you?
If you have any related question, please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
--------------------
X-Tomcat-ID: 195548074
References: <uK**************@tk2msftngp13.phx.gbl> <bm************@ID-208219.news.uni-berlin.de>
<u9**************@tk2msftngp13.phx.gbl>MIME-Version: 1.0
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
From: v-******@online.microsoft.com (Peter Huang [MSFT])
Organization: Microsoft
Date: Tue, 14 Oct 2003 07:57:25 GMT
Subject: Re: How identify active control name
X-Tomcat-NG: microsoft.public.dotnet.languages.vb
Message-ID: <cN**************@cpmsftngxa06.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
Lines: 57
Path: cpmsftngxa06.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:146476
NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122

Hi Woody,

Based on my understanding ,you want to know what field is the cell you are
selecting in.
I think you may try to get it from the datasouce. e.g. it is a dataset

Private Sub DataGrid1_CurrentCellChanged(ByVal sender As Object, ByVal
e As System.EventArgs) Handles DataGrid1.CurrentCellChanged

MsgBox(DataSet11.Tables(0).Columns(DataGrid1.Curr entCell.ColumnNumber).Colu mnName)
End Sub

Did I misunderstand you meaning?
If you have related question, please feel free to let me know.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
From: "Woody Splawn" <wo***@splawns.com>
References: <uK**************@tk2msftngp13.phx.gbl>

<bm************@ID-208219.news.uni-berlin.de>
Subject: Re: How identify active control name
Date: Mon, 13 Oct 2003 15:13:45 -0700
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <u9**************@tk2msftngp13.phx.gbl>
Newsgroups: microsoft.public.dotnet.languages.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.surewest.net 66.60.158.168Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftn gp13.phx.gbl
Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.vb:146430
X-Tomcat-NG: microsoft.public.dotnet.languages.vb

I'm sorry, I gave you incorrect information. It does work when I use it,
for example, on a txtbox on a field on a winform but I am trying to make itwork for a field on a datagrid. That is, I am on a datagrid and I would
like to identify the field on the datagrid that I am on. I assume that is
considered by VS as the ActiveControl. My intent is to leave it and then
return to it. When I use code like the following under those circumstancesI get a result of nothing.

Str = activeControl.Name

Dim sParentName As String = ActiveControl.Parent.Name gives me the name of
the datagrid but I would like the field on the datagrid that I am currentlyon.

Thank you in advance for your help.





Nov 20 '05 #7

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

Similar topics

0
by: bala | last post by:
Iam using python....to invoke VBApplication...in the VBApplication contains lot controls...for Example 1.TextBox 2)CheckBox 3)Button 4)RadioButton 5)ComboBox 6)ListBox Outoff this six...
3
by: Robert Neville | last post by:
How do you return the last Active Control when the control is on a tab control? Screen.ActiveControl does not seem to work. Here's the statement that my code uses. Set ctlOld =...
7
by: William Case | last post by:
Hi folks, Screen.PreviousControl.SetFocus works fine to select the control that had focus prior to the one that NOW has focus. Unfortunately, I've not discovered a VBA code way to get the name...
3
by: Hank | last post by:
On one of my forms I display a histogram representing the status of jobs in our factory. It's configured as a stacked bar which I create using labels of different background colors. 75 labels are...
4
by: Volker Jobst | last post by:
Hi, Is there an event of windows.forms.form which informs me that the active control will be changed before it will be changed? Something like: Private Sub Form_Validating(ByVal sender As...
8
by: Boni | last post by:
Dear all, is it possible to get a name of control on the form, which is currently in focus. Thanks, Boni
1
by: Anoop Nair | last post by:
Hi I am developing scripts in C# which can be used to test windows based applications. I use Win32 API's to perform click operations etc. To uniquely identify a control in a window rather than ...
2
by: Randy | last post by:
I have a form on which various controls are added dynamically depending on actions of the user. One of these actions allows the user to click a delete button that will remove various other...
7
by: Andrus | last post by:
I have UserControls in MDI child forms containing TextBoxes and other controls. When user re-activates form, I need that Control which was last activated is activated again. Currently *first*...
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: 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?
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.