bshaen Posted March 30, 2005 Posted March 30, 2005 i have a textbox field that allow user to enter the stdcode, after user press enter, listview.selecteditem will according what the user enter in the textbox field, i have try this ListView1.SelectedItems(i).Text = textbox1.text but it's doesn't work, it's not highlight the selecteditems in listview1 can anyone tell me what wrong with my coding above? thank Quote
*Experts* DiverDan Posted March 30, 2005 *Experts* Posted March 30, 2005 try: Dim i As Integer For i = 0 to ListView1.Items.Count - 1 If ListView1.Items(i).SubItems(0).Text = TextBox1.Text Then ListView1.Items(i).Selected = True Me.ActiveControl = Me.ListView1 Exit For End If Next I think this is what you are asking for, but the most important part of the code is Me.ActiveControl = Me.ListView1 as you must give the ListView focus in order for the ListView to display the selected item. Quote Member, in good standing, of the elite fraternity of mentally challenged programmers. Dolphins Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.