how can i get the current active control's name in a form?

thank you
Jet
[18 byte] By [jetsu] at [2008-2-7]
# 1
Hi,

try this code in your form:

MessageBox.Show(this.ActiveControl.ToString());

rgerbig at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 2
i can't find the function of tostring()

i can get the name now
i used this way
_screen.activeform.activecontrol.name

Jet

jetsu at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 3

rgerbig -> Here is a Visual Foxpro forum, not C# !

Thierryp at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 4
Hi Jet,
if you don't don't need the name of the control inside a grid you can use code like this to get the name of the active control:
IF TYPE("Thisform.ActiveControl") == "O"
lcName = Thisform.ActiveControl.Name
ENDIF

It's important to check the type beforehand, because the ActiveControl property doesn't exist if there's no active control. For grids this code would return the name of the grid, not the name of the column or textbox inside the grid.
ChristofWollenhaupt at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...