ListView Press Enter to move to next subitem

Posted on 2010-11-25
Last Modified: 2013-11-06
I have created a ListView, with all the subitem enable user to key in data. The textbox name is EditBox.

And I want it to be when user press enter key, it will move the cursor to next subitem, and when reach the last subitem and user press enter, it will move cursor to the next first subitem.

For example as below:
Location      temperature    pH      total iron    hazen
A6.....All together 50 rows

The location cannot keyin. And the field for temperature, pH, total iron and hazen can be key in by user. When user key in temperature for A1, and press enter, it will move focus to pH for A1. When user key in hazen for A1, and press enter, it will move focus to temperature for A2.

Can anybody help me on this. Expert, please help me.
Question by:alicealiciasarawak
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 2
  • 2
  • +1

Expert Comment

ID: 34212246
Create a keypress event on listview object.

Check if the key pressed was an enter button - and increment selectedindex property. Check if it reaches the end of the list and in that case reset the selectedindex to 0.

LVL 42

Expert Comment

ID: 34212410
C# /
LVL 42

Expert Comment

ID: 34212454
how did you implement editable listview?
since it is not built in functionality in .net listview, you probably customized your control.
if you used floating editbox controls (like in this post
then you already have a keypress event handler of the editbox control.
so all u need is to check subItemSelected id.
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 34215324
I have develop the ListView using VB.NET. And I have tried the keypress for listview and also the textbox. It is not working. I really need expert help.

Author Comment

ID: 34215325
Can anyone help me on this. I just want it to move to next subitem when I press enter key. Can provide sample code for this please.

Author Comment

ID: 34215607
I have used the sample from this link. Now I want that when I press enter it will move the cursor to next subitem.

Expert, please help for this.

Author Comment

ID: 34220075

Can anyone reply me? sedgwick, the example you gave me I don't want it be like that. I want it to be when user edit the field City and press enter, it will automatically move cursor or focus to second City field and do editing and press enter, it will move cursor to Continent and do editing, and press enter, it will move focus to next line.

Author Comment

ID: 34227331

Can I have a sample for this? I have the listview with textboxes using the sample from

Please do help me on this.

Author Comment

ID: 34245460
Can anyone help me?
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 34246881

In ListView, Selected SubItem can be identified by X and Y co-ordinates i.e. Location where Mouse is clicked.

Location cannot be identified with KeyPress Events...

So, it is difficult to find selected Item when particular Key is pressed ...

That's why, I think so, you cannot move to next SubItem when user presses Enter Key.

- Deepak Lakkad

Author Comment

ID: 34253662

So it is not convenient to use ListView, right? For DataGridView, can you give me a sample code for this? I really need your help.
LVL 11

Accepted Solution

Deepak Lakkad earned 500 total points
ID: 34255077

I have attached a file here.

It contains a custom control with a Test Class.

may be this will solve your requirements

- Deepak Lakkad

Author Closing Comment

ID: 34331335
Partially solved

Featured Post

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse ide not starting 16 88
The line on IDE 4 103
egit plugin on eclipse 8 129
Netbeans and org.apache.commons.lang3 issue 3 55
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question