Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. ListView control and key strokes

ListView control and key strokes

Scheduled Pinned Locked Moved C#
questiontutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Z Offline
    Z Offline
    zaboboa
    wrote on last edited by
    #1

    Hello, If the listview control is populated with items, and user preses for example key "r", the list view control scrolls to the first object in the listview control whose text starts with letter "r". How can I achive this programatically? Meaning, if I have a button, and when user presses the button, it sends a key stroke event to listview control with letter "r". Thank you.

    R 1 Reply Last reply
    0
    • Z zaboboa

      Hello, If the listview control is populated with items, and user preses for example key "r", the list view control scrolls to the first object in the listview control whose text starts with letter "r". How can I achive this programatically? Meaning, if I have a button, and when user presses the button, it sends a key stroke event to listview control with letter "r". Thank you.

      R Offline
      R Offline
      RepliCrux
      wrote on last edited by
      #2

      Something like this: private void listView1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.R) { //search the list view for item listView1.Items[0].Selected = true; } }

      Z 1 Reply Last reply
      0
      • R RepliCrux

        Something like this: private void listView1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.R) { //search the list view for item listView1.Items[0].Selected = true; } }

        Z Offline
        Z Offline
        zaboboa
        wrote on last edited by
        #3

        Thanks. But ListView control already has a default behaviour for the key strokes. I was just wondering if I can use API SendMessage somehow to emulate this default behaviour.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups