.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How to Forward the Focus?

Posted By:      Posted Date: October 04, 2010    Points: 0   Category :Windows Application


I have created own Control for RadioButton and using in GroupBox. I am facing problem while usig TabKey. MS RadioButton while pressing Tab it is selecting next control other then this group. But my control select the next control.


I need to help for below senario.

How to forward the Focus Msg in WM_SETFOCUS?

Is any API method available for this?



Lingaraj S.

View Complete Post

More Related Resource Links

lossing focus from model pop up window controls


hi i using a model pop up window with some textbox but when i click on textbox of model pop up focus move to back to page textbox control plz help me 

Editor's Note: A Look Back As We Move Forward


Here's a look at a year's worth of coverage and changes at MSDN Magazine in response to reader requests.

Howard Dierking

MSDN Magazine January 2009

Excel-like experience - gridview focus problem



I'm creating a page where people can order several items from a list without having to press "edit" and "save" in between like you normally would in a gridview. The user writes down the quantity, and finally presses a "submit" button that saves the order.

I want the user to have a windows form (or excel) like eperience, so once the user puts in the quantity and moves on to the next item, either by TAB or by clicking on the TextBox, i make some calculations without the user beeing bothered with a full refresh or having to press a buton to execute the event, so I place the controls inside an UpdatePanel and use TextBox.TextChanged. The event runs code that calculates the sum for the row (price * quantity) and shows that in a column called "Sum", and updates a label in a fixed position with the new order total ("Total").

Any ideas on how to achieve this?

Right now I use a GridView with a templatefield for the Quantity and set the TextBox.TextChanged event to fire to make the calculations. The problem is that the focus then changes.

By using SmartNavigation or the ScriptManager.SetFocus I manage to retain focus on the TextBox that executed the Postback, but the user might have moved on to a textbox far down the gridview (thus causing the postback by leaving the previo

Generated controls - skipping focus event - C# + JS


Ok, here is my senario.

A random (6-15) amount of textboxes are generated. Each textbox represents only one character. From those textboxes, three of them (at a random position) are enabled and the rest disabled.


When I put a character in any enabled textbox, it must put the focus on the next enabled textbox.


Textbox IDs go from 'char0' to 'char15' OR 'char0' to 'char12' OR ...

All the textboxes are generated so I can't set up specific focus events for each textbox because the designated control is unknown at design time.

Here is my attempt:


<script type="text/javascript">
    function abc(nextfocus)


for (int i = 0; i < focusableControls.Length-1; i++)
focusableControls[i].ClientSideEvents.KeyDown = "abc(" + focusableControls[i + 1].ID + ")";


focusableControls is an array with all the textboxes in that can get focus. It is also in the right order.

Things I want to find out:

How will I send the textbox out of focus

Toast Popup Form is Stealing Focus

I have a Windows Form application that when it is running a process it displays a MSM type toast popup.  The problem is when we create this form in a second thread and display it.  The problem is when it is displayed it steals focus from other applications or even our own.  Anyone have any ideas on this and how to make it not steal focus. I create the popup in a thread pool. ThreadPool.QueueUserWorkItem( new WaitCallback( DisplayPopUp ), new PopUpParameters( BackgroundImage, ForeColor, Clicked, Delay, Message, ButtonText ) ); This is the code for DisplayPopUp: using (PopUp p = new PopUp((PopUpParameters)popUpParameters)) { p.ShowDialog(); } Inside the form it has 3 timers.  One for Pop, Pause, and UnPop.  The form Load event is where the position of form is set and the event pop timer is started.  The events for Pop and UnPop just change the form Top location.  The form is not set to TopMost. Any help would be great. Thanks, Eric

After a void the HTMLEditor gets the focus?

 I've got a aspx page with 2 update panels. The first has a HTMLEditor (ajax control toolkit), and the second had a textfield and a butten.after i push the button (of course there is some action but no focus things) afther the action is done the focus gets to the HTMLeditor.Why ? There is no page reload (because of the updatepanel) so why get the htmleditor the focus? And the importent thing, how can i solve this?

Move focus while mouse down?

Hi All I've a button with a adoner containing a scrollbar, when the user click and hold the button for 2 seconds the adoner becomes visible, this works like a charme, and the adoner become invisible when the user release the mouse button again. My problem is, I don't know how to move the mouse focus from my button to the scrollbar, to make it scroll while the mouse still is down. In other words how do I move over a scrollbar while the mouse button is down, and then the scrollbar gets the focus and begin to scroll to the mouse pos. Please help me. Spandy   

Search References multi-platform support is forward-compatible

Remember when I introduced you to the Search References extension? I know my fellow coworkers at Clarius are awesome and all, but I was happily surprised when after installing MonoDroid, the following just worked: See the "Filtered to: MonoDroid Profile"? See how the paths point to the right assemblies under MonoDroid reference assemblies? Kudos to the http://go-mono.com/monodroid/ team for integrating so nicely in the VS2010 environment! Read full article

How to set the border for a WPF DataGrid Row which is currently having the focus

Hi, I want to set the border for a DataGrid Row which is currently having the focus. But not the seleced row because when the Multi selection is enabled for the datagrid then there is a chance that multiple rows can be selected. I need a solution in XAML Thanks in advance! Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This will help other members to find the solution easily.

Trouble getting my back/forward buttons to work correctly

My program has 4 pages that have session variables on each page and they are retrieved on the 4th and final page then submitted to a database when the submit button is clicked. When i was testing my program i filled out all 4 pages and then clicked back to refill-in something on a previous page and all my information wasn't filled out anymore. So i added the code in the page load sub btnBack.Attributes.Add("onClick", "javascript:history.back(); return false;") and this cured that problem so i could click back and the data would still be filled out. Then i saw a new problem....after i went back to fix something on previous pages 1 and 2, i would click the next button to go forward to pages 3 and 4 that i've already started filling out and now the data on those pages were cleared. So how do i make it so that the information from the whole program stays filled out whether i go back and forth from the 1st page to the 4th until i click submit on the 4th page? I have searched everywhere on the internet and cannot find a solution

Back & forward button of browser hide...

Hiwithout script can i hide back & forward button of browser ..here lot of solution given but not working properly so please give me solutionthankscraj

Premature loss of focus in WPF user control

I have a user control that consists of a dockpanel, inside of which are a textbox, a stack panel (containing two user controls), and another user control.  I am handling the LostFocus event for the dockpanel.  Since LostFocus deals with Logical Focus in WPF parlance, one would logically (pun intended) assume that if one was to click anywhere inside the dockpanel, the LostFocus event should NOT be fired for that control.  However, it appears that If I click anywhere outside of the textbox in the dockpanel, the LostFocus event is fired.  I am not using custom focus scopes since there are multiple of these user controls in my WPF window and I only want one of them to have focus at any given time. I've read many blogs and articles on WPF focus issues and so far nothing has worked.  Any help would be highly appreciated.

How to prevent Javascript window to steal focus

Hi,I have made an asp.net web application in which i open a javascript window for 4 seconds at regular interval . The problem is that when window opens it steals focus from current application. For example when application is running in background or is minimized and i am typing in word/Excel or outlook, the window pops up and steals the input focus.I want to popup window in some way that it never steal focus from some other application, just like msn or gtalk notification when someone sign in/out.Please suggest how it can be done ? Thanks

MaskedEditExtender Gets Focus on Postback

I'm having a really strange issue with the MaskedEditExtnder. I've attached some markup for one of the textboxes. I'm using a MaskedEditExtender and MaskedEditValidator along with a CalendarExtender so the user has the option to type the date or click on an image and pick the date. So, if I enter/pick a date then select a control that forces a postback (usually a dropdownlist but not always) when the page is returned the focus goes back to the textbox I just entered the date in. So what about the MaskedEdit, MaskedEditValidator, CalendarExtender would cause the page to return focus to the control being extended? See markup below - am I missing something??  <asp:TextBox ID="txtEffectiveDate" runat="server" Width="100px" CssClass="textbox" AutoCompleteType="Disabled" Font-Bold="True"/> <asp:ImageButton ID="ImgBtnCalc1" runat="server" ImageUrl="~/images/Calendar_scheduleHS.png" CausesValidation="False"/> <cc1:MaskedEditExtender ID="txtEffectiveDate_MaskedEditExtender" runat="server" Enabled="True" TargetControlID="txtEffectiveDate" Mask="99/99/9999" MaskType=&qu

How to determine when focus moves into a RowDetails panel in a DataGrid?

Is there a recommended way of determining when focus moves from the selected row into the details panel and knowing which field the focus is on? I don't really want to wire up all the controls in the panel, so am looking for a better way - all suggestions appreciated:-)

Retaining the selection color(default blue Color) for the selected items in ListView when focus is l

I am having a Listview in a form. I have added items(images) to the Listview. When i select the item(Image) in the listview , the item(image) is selected with Default selection Color(Blue). In the same form i have other form added to its container.When i tried to click on the controls of other form, the default selection color(blue) is changing to Grey color. For the lisview i am using property HideSelection = false. How i could maintain the default selection color(blue) even in focus leave of listview? Can any one please suggest me a solution or give me a piece of code. Thanks in Advance, Kumar
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend