Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / February 2006

Tip: Looking for answers? Try searching our database.

Textbox Listbox

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Sudhee - 14 Feb 2006 22:14 GMT
Hi,
I have textbox and listbox on my form . Listbox has data. When user key in
the data in textbox closest item in listbox should get selected.  (like
keypress in listbox) .How to achieve this
Thanks in advance
Sudheendra
Stoitcho Goutsev (100) - 15 Feb 2006 14:50 GMT
Sudhee,

You should use ListBox's FindString or FindStringExact methodos. In your
case I believe you need the FindString method.

Signature

HTH
Stoitcho Goutsev (100)

> Hi,
> I have textbox and listbox on my form . Listbox has data. When user key in
> the data in textbox closest item in listbox should get selected.  (like
> keypress in listbox) .How to achieve this
> Thanks in advance
> Sudheendra
Sudhee - 15 Feb 2006 15:21 GMT
Hi,
Thanks, This works only problem I am facing is when I type in textbox first
letter ,the focus will always go to the first item in the list box ,only
after I enter second letter it will search for the first letter for example
I have
Apple
Orange
Guava
Banana

If I type O in text box it will first focus Apple and on keying r it will
focus orange. Always goes to the first item. is there anyway to overcome this.
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress

        Me.ListBox1.SelectedIndex = Me.ListBox1.FindString(Me.TextBox1.Text)
   End Sub
Thanks
Sudhee

> Sudhee,
>
[quoted text clipped - 7 lines]
> > Thanks in advance
> > Sudheendra

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.