473,372 Members | 825 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,372 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 17308
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*...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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.