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

thank you
Jet


Answer this question

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

  • Alan Tolan

    Hi,

    try this code in your form:

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



  • chenwen

    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.


  • Michael ADDS

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


  • CNU

    i can't find the function of tostring()

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

    Jet

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