Click here to Skip to main content
15,891,375 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello everyone again I'm so sorry I'm asked many questions in here I think next time admin will block me hhhh :'(

anyway my question this time how I can keep my form always on top but the problem is not how I can do it because I do it by Property ( TopMost = true ) .... the problem is how I can keep it always on top and not on top hhhh I don't know how I can explain what I need ( look at image to understand my question ) ... the form is on top but when I focus on any other TextBox outside my form I can write in it ... please anyone knows what property can do this ??

1 : image what I want

https://i.postimg.cc/rwMRgVH7/1-1.png[^]

2 : image my form

https://i.postimg.cc/Zn5DrzSN/1-2.png[^]

What I have tried:

I tried search in the web and found nothing because I don't know what event exactly I should search for it !!
Posted
Updated 21-Dec-20 6:38am
v2
Comments
Richard MacCutchan 21-Dec-20 7:58am    
"how I can keep it always on top and not on top"
Sorry, that does not make sense, and the images do not help to make it clearer.
hamza mostakim 21-Dec-20 8:04am    
Thank you sir for paying attention many times ❤️
so what about I want when focus on TextBox outside my form I can write in it when click on button ?? what events can do this ??
Richard MacCutchan 21-Dec-20 8:13am    
As soon as you click a button in your form the focus moves back to that form, so I don't think that would work. The only way for your application to write into another Window (e.g. TextBox) is to get a handle to that control. But I do not think you can do that just by clicking it.
hamza mostakim 21-Dec-20 8:37am    
Yes this exactly what happened " As soon as you click a button in your form the focus moves back to that form " ... anyway Thank you very much for your information sir I will try search again :)
Richard MacCutchan 21-Dec-20 9:20am    
In order to get the handle to the TextBox you are looking for, you need to use the EnumWindows function. But there is no easy way to identify which Window matches the handle.

1 solution

 
Share this answer
 
Comments
hamza mostakim 23-Dec-20 5:05am    
can you help more please :

before run and build the ( demo project ) in the article a get this message :

https://i.postimg.cc/VsjqVBKh/1-1.png[^]

and after run and build it a get this error :

https://i.postimg.cc/26d12TCF/1-2.png[^]

do you know how I can fix it please ??
hamza mostakim 23-Dec-20 5:07am    
ok ok sir thank you so much I think I found how I can fix it ❤️ ❤️ ❤️
hamza mostakim 23-Dec-20 7:53am    
I fixed the error ... but I think this not what I want ??

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900