473,717 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

question which control has focus.

Hi All,
When a textbox loses focus is there a quick way to find out which control has received
the focus whilst in the textbox lostfocus/leave event ?

Many Thanks.
Jan 8 '06 #1
1 3518
Hello

I think one of the solution coulde be like this
for (int i=0; i<this.Controls .Count; i++)

{

if (this.Controls[i].Focused==true)

{

// Anything u want to do

}

}

<Co**********@a l.com> wrote in message
news:11******** *******@ersa.uk .clara.net...
Hi All,
When a textbox loses focus is there a quick way to find out which
control has received
the focus whilst in the textbox lostfocus/leave event ?

Many Thanks.

Jan 8 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2583
by: Sammy | last post by:
Hi, I want to make the enter key function like the tab key in WinForms. I used to do it in VB6 using the code below: If KeyAscii = 13 Then ' The ENTER key. SendKeys "{tab}" ' Set the focus to the next control. KeyAscii = 0 ' Ignore this key. End If
1
1672
by: Paul Tsai | last post by:
Dear All, I used csharp web form to develop my company web application, and my question is how shuld I do if I want to focus on my textbox(ex. like Java Script form.txtID.focus()). Thanks !! Sincerely yous, Paul
3
1554
by: | last post by:
Hi , I did ask before but got no replies. I have a series of textboxes, In Enter event I need to set the focus to a different textbox I am having problems when I set focus within the Textbox Enter event. It is looping thru the events. Does anyone know how I can set focus to another object when the Textbox has received focus either by keyboard or mouse event.
4
1314
by: starbuck | last post by:
We have some fields with AutoPostBack set to true and when user tabs to the next field the screen re-calculates correctly however we also lose which control/text box had focus when the user tabbed. Is there any way of storing and resting which control should have focus? We are using asp.net with vb.net for code. Thanks ---
6
1383
by: Mike | last post by:
I have a few textbox controls that have autopostback so that when they loose focus they update a label control that shows the count of characters in their respective text control. This works fine, except that after the postback, the page is shown reset -- scrolled to the top and with no control having focus. Can I maintain scroll/focus w/o writing client-side scripting? thanks
1
5135
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
4
4303
by: Jon Slaughter | last post by:
I've created some custom controls and forms that allow the feature to temporarily transfer focus to a control that has been entered by the mouse. Everything seems to work fine but the problem I have is that sometimes I seem to loose the original "holder" of focus and when the user hits tab while using "temporary" focus(while the mouse is over a control) it will change focus to the next control but not update it. So I have several issues....
8
9767
by: OldBirdman | last post by:
This should be so, so simple I hesitate to ask. I have a Form named "fNavButtons" used as a SubForm in control named "subformNavButtons". subformNavButtons is a control on my main form named "fAAA". fNavButtons has 2 CommandButtons, cmdNextRec and cmdPrevRec. These are on a subform to allow an AutoRepeat to continue when form fAAA gets another record. If I am at the first record, I want cmdPrevRec.Enabled = False, and if I am at the...
1
1055
by: inadsad | last post by:
Greetings All, I have one mdi form with serveral forms open. How can I set focus to one of these forms? meaning the only way I can set focus is to mouse click on the blue top bar. Is there a way to set focus on a form by clicking on any where on the form? Forms contain text boxes, drop- down, etc. Good Day and Thanks, Ian
2
918
by: bobh | last post by:
Hi All In AccessXP I have a tab control with 5 tabs and I went to requery a combobox if and only if the user is moving from one perticular tab. I have this in place right now (On Change event of the tab control) but it does not do exactly what I want as it requeries cboParty each the user clicks on a non-'Page28' tab. If Me.TabCtl10.Pages.Item(TabCtl10.Value).Name <"Page28" Then Me.cboPARTY.Requery
0
8719
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9348
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9109
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9048
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7981
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5970
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3177
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2545
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2120
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.