473,623 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.P arent.Name

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

Str = activeControl.N ame

does not seem to work.


Nov 20 '05 #1
6 17332
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******** ******@tk2msftn gp13.phx.gbl...
I know that I can do the following to identify the parent name of an active control

Dim sParentName As String = ActiveControl.P arent.Name

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

Str = activeControl.N ame

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.P arent.Name

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

Str = activeControl.N ame

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.N ame

Dim sParentName As String = ActiveControl.P arent.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_Curre ntCellChanged(B yVal sender As Object, ByVal
e As System.EventArg s) Handles DataGrid1.Curre ntCellChanged

MsgBox(DataSet1 1.Tables(0).Col umns(DataGrid1. CurrentCell.Col umnNumber).Colu m
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.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.sure west.net 66.60.158.168
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:146430
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.N ame

Dim sParentName As String = ActiveControl.P arent.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.m icrosoft.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.publi c.dotnet.langua ges.vb
Message-ID: <cN************ **@cpmsftngxa06 .phx.gbl>
Newsgroups: microsoft.publi c.dotnet.langua ges.vb
Lines: 57
Path: cpmsftngxa06.ph x.gbl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.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_Curre ntCellChanged(B yVal sender As Object, ByVal
e As System.EventArg s) Handles DataGrid1.Curre ntCellChanged

MsgBox(DataSet 11.Tables(0).Co lumns(DataGrid1 .CurrentCell.Co lumnNumber).Col u 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.publi c.dotnet.langua ges.vb
NNTP-Posting-Host: 168.158-60-66-fuji-dsl.static.sure west.net 66.60.158.168Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!tk2 msftngp13.phx.g bl
Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.vb:146430
X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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.N ame

Dim sParentName As String = ActiveControl.P arent.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
1218
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 control....iam able to identify the Button,RadioButton and CheckBox Control...But iam not able to find the TextBox,Combobox and ListBox control name
3
10059
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 = Screen.ActiveControl The code line work when all controls are placed on the form page rather than a tab control. This code should pass the last active control to the calling module. Then the following line requests the tabindex from the control.
7
85613
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 of the control, that currently has focus. It would be nice if the Screen object had a property called "CurrentControl" that could be stored in a variable, as in: "X = Screen.CurrentControl.Name" Am I overlooking something?
3
2544
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 arranged in, up to, 15 vertical bars representing different customers. When the user clicks on one of the labels I display a list box with details about the data in the bar. I only want to know which stack and which bar was clicked so I can...
4
7842
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 Object, ByVal e As ...) Handles Form."EVENT HERE" dim Ok as Boolean = False ... If Not (ok = True) Then
8
21306
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
1834
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 using absolute position of a control I have been using Control-ids and captions of the control. But I found scenarios where the control-id was dynamic and the control didn't have a caption. What I mean by caption is the text of the control. A...
2
2103
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 controls. I was trying to accomplish this Click procedure by capturing the active contold using activecontrol.name and then removing it, but as soon as I click on the Delete button, the active controls changes to the delete button, not the control that...
7
14616
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* control is activated always. To reproduce: 1. Run code. 2. Make TextBox2 as current TextBox by selecting its text
0
8165
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
8670
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8326
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7150
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...
0
5561
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4074
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...
1
2602
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
1
1778
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1473
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.