By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,948 Members | 663 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,948 IT Pros & Developers. It's quick & easy.

TextChanged event firing before the KeyXXX events

P: n/a
Hi all,

I have a combobox control, in wich I put an autocomplete code. This code is
in the TextChanged event, but when this event fires, the Text property isn't
updated yet.

For example, if the Text property is "Foo" and I press the letter "d", the
Text property when the TextChanged event runs is "Foo". Only after the
TextChanged event be processed, the KeyDown, KeyUp and KeyPress events fires
and update the Text property.

I think it's very strange. Is it a bug? How can I get the correct Text
property in the TextChanged event?

Thanks in advance,
Fabrício de Novaes Kucinskis.
Jul 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi,

Can you post the code you are using? I have tried this out with .NET
framework 1.0 and the Text property returns the current text in TextChanged
event. Also at my end the KeyDown event fired before the TextChanged event.
Below is the code I tried:
Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged

Console.WriteLine(TextBox1.Text)

End Sub

Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown

Console.WriteLine("fired")

End Sub

"Fabrício de Novaes Kucinskis" <fa*********@uol.com.br> wrote in message
news:eD**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have a combobox control, in wich I put an autocomplete code. This code is
in the TextChanged event, but when this event fires, the Text property isn't
updated yet.

For example, if the Text property is "Foo" and I press the letter "d", the
Text property when the TextChanged event runs is "Foo". Only after the
TextChanged event be processed, the KeyDown, KeyUp and KeyPress events fires
and update the Text property.

I think it's very strange. Is it a bug? How can I get the correct Text
property in the TextChanged event?

Thanks in advance,
Fabrício de Novaes Kucinskis.

Jul 19 '05 #2

P: n/a
Hallo,

"Fabrício de Novaes Kucinskis" <fa*********@uol.com.br> schrieb:
I have a combobox control, in wich I put an autocomplete code.


Does this code work?

http://www.codeproject.com/vb/net/au...e_combobox.asp

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet
Jul 19 '05 #3

P: n/a
Hi Herfried, Prateek,

My code is similar to the codeproject's code. I tried it (my code) in two
other computers, and it works correctly. I think the problem is my computer
(therefore I have no idea on what can do this kind of error).

I'll run the Windows Update, and try again.

Thanks for the help,
Fabrício.


"Herfried K. Wagner [MVP]" <hi*******@m.activevb.de> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hallo,

"Fabrício de Novaes Kucinskis" <fa*********@uol.com.br> schrieb:
I have a combobox control, in wich I put an autocomplete code.


Does this code work?

http://www.codeproject.com/vb/net/au...e_combobox.asp

HTH,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet

Jul 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.