473,387 Members | 3,821 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,387 software developers and data experts.

setting focus to control after validation

I have a number of controls on a tab page. I want to validate them all
when the user tries to leave the tab. I then want to highlight the
first control which fails validation. How can I do this? I try setting
focus but something seems to set the focus back to the control which
had it before validation. Any ideas?

TIA,
KK
Jan 12 '08 #1
3 2130
If you are using MFC, see MFC Library Reference TN026: DDX and DDV Routines
Jan 14 '08 #2
On 14 Jan, 19:46, "Sheng Jiang[MVP]" <sheng_ji...@hotmail.com.discuss>
wrote:
If you are using MFC, see *MFC Library Reference TN026: DDX and DDV Routines
Thanks, but I'm not using MFC, that's why I posted in a dotnet forum.

KK
Jan 14 '08 #3

<ke***********@googlemail.comwrote in message
news:a4**********************************@s13g2000 prd.googlegroups.com...
>I have a number of controls on a tab page. I want to validate them all
when the user tries to leave the tab. I then want to highlight the
first control which fails validation. How can I do this? I try setting
focus but something seems to set the focus back to the control which
had it before validation. Any ideas?
What is the call stack when you change the focus? If it is in the middle of
processing a focus change event then something might indeed change the focus
afterward.

You could post a custom message to yourself and set the focus then, it will
be placed at the end of the message queue instead of setting the focus
synchronously. The .NET way of doing PostMessage to another thread is with
Control.BeginInvoke, I'm not sure how that would work on the same thread.
I'd use the real PostMessage just to be safe. Or for pure .NET, a winforms
timer could work too.
>
TIA,
KK

Jan 31 '08 #4

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

Similar topics

4
by: Nitin | last post by:
Hi I have created function to check date and time. at the time of execution, if date is left empty the function returns the error message but then the focus goes to next field. Next filed is for...
5
by: tshad | last post by:
I have a date validation function that I want to stay at the object I am validating if there is a Validation error, but it always goes to the next object. The Javascript: function...
0
by: ED M. | last post by:
Hello all...I'm new to the board. I have a problem that I hope someone here might be able to solve for me. I am doing some clientside validation using Javascript. The text I am testing is...
0
by: Miquel | last post by:
Hi all. I felt frustrated when developing an 'UserControl' derivated from textBox, because sequence event (and Validate event) seems to fail. I Always thought my code was wrong. But after...
2
by: Vinod I | last post by:
Hi Team, I am using validator controls. Please let me know how to set the focus back to the control after validation. Thanks in advance... cheeeeeeeeers!!!
7
by: saurabh | last post by:
Hey, I have a form in which there are say 10 fields. I am using validator control for all the fields. suppose user forgets to fill field no. 5, 8 , 9 and 10. So on clicking the save...
3
by: vivela | last post by:
hi, I hope you could help me out on this one,cause I have been trying for 4 days to solve it,but couldn't quite get it right: I have an ASP textbox that should change the value in a dropdownlist....
1
by: Praveena.Alapati | last post by:
Hi, There is a tab control on a page with multiple tabs and handful of controls in each tab. The way it's rendered in html (like grid etc..) is in table format in tablerows and cells. On...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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...

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.