473,325 Members | 2,785 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,325 software developers and data experts.

Starnge problem with Focus() and LostFocus()

Hi,

i have a textBox that when it get focused i'm sending ALT+SHIFT (to change
the current language) i compare the current language to the one i need (using
InputLanguage.CurrentInputLanguage), and when it loses focus i compare the
current language to the default language and if are different i'm sending
alt+shift again to change back to the default language.
My problem is that if i move from one TextBox to the Second and they both
have these events, only one ALT+SHIFT sending instead of two (one time it
suppose to return to the defualt language and on the second to change back to
the language i need). if i move from one TextBox that has these events to one
that doesn't have and then to TextBox that has this event it works fine. I
think that these two event (Focus and LostFocus) are too fast for the
ALT+SHIFT sending (the Current Language is not updated so quickly), i thought
maybe to send a Wait or Sleep before i'm sending ALT+SHIFT but i couldn't do
it (Sleep works only on Threads), Does anyone have an idea?
Thanks,
Nov 17 '05 #1
1 1923
Hi,

You can use Sleep in the UI thread too:
Thread.CurrentThread.Sleep( );

It not a good idea though.

You do not need to send an ALT+SHIFT CurrentInputLanguage is a set/get
property, so you can set it from the code.

I think that will solve your problem
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation


"Gidi" <sh*****@hotmail.com.dontspam> wrote in message
news:A6**********************************@microsof t.com...
Hi,

i have a textBox that when it get focused i'm sending ALT+SHIFT (to change
the current language) i compare the current language to the one i need
(using
InputLanguage.CurrentInputLanguage), and when it loses focus i compare the
current language to the default language and if are different i'm sending
alt+shift again to change back to the default language.
My problem is that if i move from one TextBox to the Second and they both
have these events, only one ALT+SHIFT sending instead of two (one time it
suppose to return to the defualt language and on the second to change back
to
the language i need). if i move from one TextBox that has these events to
one
that doesn't have and then to TextBox that has this event it works fine. I
think that these two event (Focus and LostFocus) are too fast for the
ALT+SHIFT sending (the Current Language is not updated so quickly), i
thought
maybe to send a Wait or Sleep before i'm sending ALT+SHIFT but i couldn't
do
it (Sleep works only on Threads), Does anyone have an idea?
Thanks,

Nov 17 '05 #2

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

Similar topics

6
by: Patrick De Ridder | last post by:
How do I connect to an event being thrown when a field has lost focus? Could you please give a code example? -- Patrick De Ridder ngmail@freeler.nl
2
by: Robert W. | last post by:
I'm developing a WinForms app and have a slight problem that I hope someone can help me with. There are a series of textboxes that the user can enter information into. The text in these boxes is...
18
by: Euphor2 | last post by:
I'm in school, taking a VB .NET 2003 course, and the teacher taught us how to use Sender.Focus() to return focus to the control from which focus was received. However, when I got home, and tried...
1
by: DomGo | last post by:
Hi, I try to open a form, that automatically loses focus to the window, that had the focus immediatly before the new form has been opened. The new form is topmost and displays a message only for...
0
by: Wayne Wengert | last post by:
I have a form on which I change background colors when textbox get focus and I reset the background color when it loses focus. This works fine except when I change the focus via code. If I validate...
0
by: Stefan De Schepper | last post by:
Dear NG, I created a gridlike usercontrol. When clicking on a cell a textbox (or other control, depending on the cell's editortype) is shown. When some other control gets the focus, the textbox...
2
by: Sam | last post by:
Hi, I've got two grids on my form. When one loses the focus I do the following: Private inFocusing As Boolean = False Private Sub dgParams_LostFocus(ByVal sender As Object, ByVal e As...
1
by: Robinson | last post by:
Hi, I want a user control I have to "dissapear" when it loses the focus. The control is made up of some other controls however, a text box, a button and a DateTimePicker. In order to effect...
1
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I've noticed that controls do not raise a Validating event if they are contained in a ToolStripDropDown via a ToolStripControlHost item. Please run the following sample and follow the instructions...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.