-
February 3rd, 2012, 09:09 AM
#1
Scroll Listview items by text box
At first I am totally new in VB 2008. In my project I Three textboxes and a listview. I can find the items of listview by 1st textbox change event. The codes are as given below:-
Code:
Private Sub sealv_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles sealv.TextChanged
Dim i As Integer
For i = 0 To LV1.Items.Count - 1
LV1.Items(i).BackColor = Color.White
Next
With LV1
lst = .FindItemWithText(sealv.Text, True, 0, True)
If Not lst Is Nothing Then
.Items.Item(lst.Index).EnsureVisible()
.Items.Item(lst.Index).BackColor = Color.YellowGreen
Else
For i = 0 To LV1.Items.Count - 1
LV1.Items(i).BackColor = Color.White
Next
.Items.Item(0).EnsureVisible()
.Items.Item(0).BackColor = Color.YellowGreen
End If
End With
lst = Nothing
End Sub
Now, I want to learn the followings:-
1) How to scroll the listview items by textbox keyDown and KeyUp event.
2) And I want to get the listview focused item in the 2nd and 3rd textbox by 1st textbox keypress event( Enter press on keyboard).
Please help me regarding the above.
Last edited by pathllk; February 3rd, 2012 at 01:34 PM.
Reason: Edit cODE
-
February 3rd, 2012, 10:07 AM
#2
Re: Scroll Listview items by text box
By KeyDown and KeyUp I am taking it you mean Up Arrow and Down Arrow?
You would use the KeyDown Event for this. You would then add code to detect the key(s) you want to do something. You will need to know the KeyCode of the key(s) you want to use. The easy way to get the KeyCode is to place some code in the KeyDown event that displays the KeyCode of the key pressed in a label or msgbox then run the program and hit the keys you will want to use taking note of the keycode shown for each.
Always use [code][/code] tags when posting code.
-
February 3rd, 2012, 12:46 PM
#3
Re: Scroll Listview items by text box
Please go back and edit your first post, to add CODE TAGS for readability.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|