Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • *Experts*
Posted

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.

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...