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

Update the value property of a textbox without losing the focus?

P: 13
Hi, I'm creating a "Filter-as-you-type" feature.
The problem is: when a textbox is being keyed in, only the Text property changes but the Value property, which I want to use, doesn't.
The only solution I found is to set the focus to another control and hence causes the update.
However, if I use this method, The function will end with the text in the box I have just typed in highlighted.
Then you will see that this is not much of the "Filter-as-you-type" I hoped because the user have to press 'end button' in order to continue his typing.

Any ideas? thanks,
Sep 2 '08 #1
Share this Question
Share on Google+
2 Replies

P: 13
To: Whoever read this thread.

I have figured it out.
I just check if one of the controls has the focus when the filtering has to be performed. Then just write obj.value = obj.text if it is a textbox (if instead it is a combobox, this might a little bit more compolicated.)

However, the text inside the search box will still be highlighted anyway because of requerying or whatever.
This can be solved by putting the search boxes on a main form and using a subform to display the records. Hence, only the subform need to be requeried.

...If anybody has a better way to do this, let's share it. thanks
Sep 2 '08 #2

Expert 2.5K+
P: 2,653
Hello, Billiska.
  • What is wrong with retrieving textbox content via Text property, why do you need TextBox.Value to be changed?
  • You may use TextBox.SelStart and TextBox.SelLength properties to manipulate TextBox current selection and/or cursor position.

Sep 2 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.