Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2004, 02:09 PM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default using textbox keypress/text changed

Is there a way to use keypress/text changed where you use that event to access data then display the data within the textbox? For example, you use textchanged to retrieve data and look for "artichoke" and type 'a'. It finds all things that start with 'a' and puts the first returned result in the textbox (lets say the first was "apple"). However the event fires again (it searchs for the results using "apple"). So even if you had "artichoke" you won't see it.

I was thinking of highlighting the possible display after it and somehow not making that count as user inputed text. Any ideas?

 
Old September 15th, 2004, 01:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

I'm not sure what you want, let me guess -are you trying to make something like an autocomplete list box or combobox like the font combo box in microsoft word.
 
Old September 15th, 2004, 07:59 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Hey,

Text changed works when the control loses focus. So if they typed an A, they would have to click out of that control for it to even work. Unless you try hosting a C# forms control in a web form.

If you are talking windows forms, yes it can be done. Though I've never done it, I've seen it done.

Brian
 
Old September 15th, 2004, 08:18 AM
Registered User
 
Join Date: Sep 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Correct, I was talking about a windows form using c#

 
Old September 17th, 2004, 06:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

Highlighting the added part is a good idea.

Like if 'a' is pressed and 'apple' is searched and put in the text box --highlight 'pple'. Now if lets say 't' is pressed the highlighted 'pple' gets replaced with 't' and 'at' is searched now.

You may also wannt to disable the search when backsapce and delete are pressed.

I had written a somewhat similar thing only that i had a combobox acting as the list of data.
 
Old October 10th, 2004, 12:03 AM
Friend of Wrox
 
Join Date: Feb 2004
Posts: 177
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For ComboBox autocomplete you can use the following link, it is good.

http://www.kbalertz.com/Feedback_319946.aspx



It is not how much we do,
but how much love we put in the doing.

-Mother Theresa





Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying text in textbox Europom Excel VBA 4 March 31st, 2007 06:28 AM
Cannot update textbox.text John Leo ASP.NET 2.0 Basics 0 March 27th, 2007 08:45 AM
Remove value of dropdown list when textbox changed sn00pyg4rfi3ld Javascript How-To 1 January 20th, 2005 07:08 AM
Aligning Text of a textbox mahulda General .NET 0 July 27th, 2004 12:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.