Hi again, i was thinking on how can i see wich window is focus? Like when open something, know the name of the window, where should i look for it?
Focus Window
Page 1 of 15 Replies - 149 Views - Last Post: 30 January 2013 - 03:14 PM
Replies To: Focus Window
#2
Re: Focus Window
Posted 30 January 2013 - 01:16 PM
Well, off the top of my head you could look through the My.Application.OpenForms collection and check which one has .Focused = true
There's probably another way, but it was just the first thing I thought of.
There's probably another way, but it was just the first thing I thought of.
#3
Re: Focus Window
Posted 30 January 2013 - 01:28 PM
CharlieMay, on 30 January 2013 - 01:16 PM, said:
Well, off the top of my head you could look through the My.Application.OpenForms collection and check which one has .Focused = true
There's probably another way, but it was just the first thing I thought of.
There's probably another way, but it was just the first thing I thought of.
ContainsFocus is probably more reliable
For Each frm As Form In Application.OpenForms
If frm.ContainsFocus Then
MessageBox.Show(frm.Name)
End If
Next
But I would question why you need to do this? Where would you put this code?!
Each form should be self-contained - responsible for its own destiny - so your request should not really be necessary.
Added: We can read the property directly with the shared property ActiveForm:
MessageBox.Show(Form.ActiveForm.Name)
This post has been edited by andrewsw: 30 January 2013 - 01:30 PM
#4
Re: Focus Window
Posted 30 January 2013 - 02:09 PM
Thanks for the help, that's useful to know even not what i was looking, i was looking in the window itself, not inside the app.. i found it here http://social.msdn.m...a3-646ab6551f09
Thanks, as i say, that's useful for the future and sorry if i didn't make my question clear.
Thanks, as i say, that's useful for the future and sorry if i didn't make my question clear.
#5
Re: Focus Window
Posted 30 January 2013 - 02:45 PM
HeBTeMy, on 30 January 2013 - 02:09 PM, said:
Thanks for the help, that's useful to know even not what i was looking, i was looking in the window itself, not inside the app.. i found it here http://social.msdn.m...a3-646ab6551f09
Thanks, as i say, that's useful for the future and sorry if i didn't make my question clear.
Thanks, as i say, that's useful for the future and sorry if i didn't make my question clear.
Yes, you did refer to window in your opening post
No worries. Andy.
This post has been edited by andrewsw: 30 January 2013 - 02:46 PM
#6
Re: Focus Window
Posted 30 January 2013 - 03:14 PM
Yeah, i know that : D, i just did not want to type "How i can see the name of the form that is focused on the Windows (OS) not the app one.) or similar, anyway, thanks for the help.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|