CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Scroll Listview items by text box

  1. #1
    Join Date
    Jul 2011

    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:-

    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
    	        With LV1
    	            lst = .FindItemWithText(sealv.Text, True, 0, True)
    	            If Not lst Is Nothing Then
    	                .Items.Item(lst.Index).BackColor = Color.YellowGreen
    	                For i = 0 To LV1.Items.Count - 1
    	                    LV1.Items(i).BackColor = Color.White
    	                .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

  2. #2
    DataMiser is offline Super Moderator Power Poster
    Join Date
    Jul 2008

    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.

  3. #3
    Join Date
    Jan 2006
    Fox Lake, IL

    Re: Scroll Listview items by text box

    Please go back and edit your first post, to add CODE TAGS for readability.
    ' Like THIS

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)