473,395 Members | 2,446 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Detecting when a datagrid control loses focus

The LostFocus event of datagrids is fired when the focus is added to a
cell. How do you go about detecting it when the control as a whole has
lost focus to another control?

Slightly confused by this!

Greg.

Apr 18 '06 #1
3 6110
Greg,

I think you want the 'Leave' event for the DataGrid. That should fire when
the control itself is no longer the active control

WhiteWizard (aka Gandalf)
MCSD.NET, MCAD, MCT
"Greg" wrote:
The LostFocus event of datagrids is fired when the focus is added to a
cell. How do you go about detecting it when the control as a whole has
lost focus to another control?

Slightly confused by this!

Greg.

Apr 18 '06 #2
Thanks for that. I've tried it, but this is only fired when the focus
is lost to another control, not the form. I need to know when the main
form receives focus, as well as any controls. However, due to
architectural constraints, I can't add any code to the main form - so
the coding has to be done within my derived datagrid.

Getting a reference to the main form and adding feedback for gotfocus
doesnt work either!

Thanks again.

Greg.

Apr 18 '06 #3
Greg,

I'm pretty certain that the main Form cannot get focus as long as there are
controls that can get the focus. However, you can use the "Activated" event
to know when the form has been entered/reentered after you leave it. That
might be what you need. This has changed in .NET as it gets fired more often
now. Basically it gets fired whenever you go away from the form and come
back to it, either from inside or from outside the application.

HTH
WhiteWizare (aka Gandalf)
MCSD.NET, MCAD, MCT
"Greg" wrote:
Thanks for that. I've tried it, but this is only fired when the focus
is lost to another control, not the form. I need to know when the main
form receives focus, as well as any controls. However, due to
architectural constraints, I can't add any code to the main form - so
the coding has to be done within my derived datagrid.

Getting a reference to the main form and adding feedback for gotfocus
doesnt work either!

Thanks again.

Greg.

Apr 18 '06 #4

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

Similar topics

2
by: epigram | last post by:
I have a form on a web page that contains several textbox controls (i.e. input type="text") and a checkbox. As soon as the text changes, in only a subset of these textbox controls, I want to...
5
by: (Pete Cresswell) | last post by:
I've got a TreeView on the left of my screen. As the user navigates the tree, I load corresonding detail info into the rest of the screen. Works ok, but when the user clicks on a detail field,...
1
by: J.H.. | last post by:
With who way I can remove the focus from a DataGrid Control using the key Tab in a WinForm in C# ? The key Tab transports the focus in the next column of DataGrid and no in the next WinForm Control.
3
by: Gidi | last post by:
Hi, Is it possible to know when TextBox loses focus to which object it lost it? what i mean is when the LostFocus Event occur is it possible to know which object got the focus instead? thanks,
5
by: Stewart | last post by:
Pressing a Save Button on a Toolbar will not bind or validate the last value entered in a text box. I have found that when clicking on the Toolbar the focus in the binded text box does not leave. ...
1
by: Claire | last post by:
I'm writing an application with custom skinned controls. I have a text editor form with a rich edit control. Because there's no toolbuttons in the skinned control set, I have to use normal ones for...
1
by: jjwhite01 | last post by:
I am working on a web form that contains a Calendar control with an image button that makes the calendar appear and disappear. However, I would like to set the visible property of the Calendar...
1
by: danyeungw | last post by:
I get the following from the link http://support.microsoft.com/kb/314206. I need to have both work - the page stays where it is and set focus to next control. Does anyone have solution? I have...
11
by: =?Utf-8?B?RWl0YW4=?= | last post by:
Hello, I have a WinForm application. The form has one Tab Control and one ToolStrip. I would like to know what would be the best way to detect when the user is "leaving" the Tab Control and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...
0
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,...

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.