I am currently translating a windows form application, written in VB6, to a webpage written in Visual Studio 2010.
In VB6 it is easy to find out which control has focus on the form using ‘.getFocus()’. I have come to the conclusion it is not that easy, if at all possible, in vb2008.
Is this possible to do?
In WinForms you can create a foreach loop like this and check if a specific control has focus:
Or like spacemonkeyes said, use
this.ActiveControlor VB’s versionMe.ActiveControlHowever for a webpage I think you have to use JavaScript. The document object has a property named ActiveElement which as far as I know, only IE supports this property:
document.ActiveElementIt returns a reference to the focused control.
To use it on the server side, you have to have a form which is submitted to the server or you could use Ajax to submit that particular control. Pretty complex codings are required.