Solved

ListView Press Enter to move to next subitem

Posted on 2010-11-25
13
686 Views
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
A1
A2
A3
A4
A5
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.
0
Comment
Question by:alicealiciasarawak
  • 8
  • 2
  • 2
  • +1
13 Comments
 
LVL 1

Expert Comment

by:psalkiew
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.

0
 
LVL 42

Expert Comment

by:sedgwick
ID: 34212410
C# / vb.net?
0
 
LVL 42

Expert Comment

by:sedgwick
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 http://www.csharphelp.com/2006/10/c-editable-listview/)
then you already have a keypress event handler of the editbox control.
so all u need is to check subItemSelected id.
0
 

Author Comment

by:alicealiciasarawak
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.
0
 

Author Comment

by:alicealiciasarawak
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.
0
 

Author Comment

by:alicealiciasarawak
ID: 34215607
I have used the sample from this link. http://www.codeguru.com/vb/gen/vb_forms/listviewcontrols/article.php/c16251. Now I want that when I press enter it will move the cursor to next subitem.

Expert, please help for this.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:alicealiciasarawak
ID: 34220075
Hello,

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.
0
 

Author Comment

by:alicealiciasarawak
ID: 34227331
psalkiew,

Can I have a sample for this? I have the listview with textboxes using the sample from http://www.codeguru.com/vb/gen/vb_forms/listviewcontrols/article.php/c16251.

Please do help me on this.
0
 

Author Comment

by:alicealiciasarawak
ID: 34245460
Can anyone help me?
0
 
LVL 11

Expert Comment

by:Deepak Lakkad
ID: 34246881
Hi,

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
0
 

Author Comment

by:alicealiciasarawak
ID: 34253662
deepaklakkad,

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.
0
 
LVL 11

Accepted Solution

by:
Deepak Lakkad earned 500 total points
ID: 34255077
Hi

I have attached a file here.

It contains a custom control with a Test Class.

may be this will solve your requirements

- Deepak Lakkad
MyDGV.zip
0
 

Author Closing Comment

by:alicealiciasarawak
ID: 34331335
Partially solved
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to debug CodeIgniter (PHP) 7 293
PHPStorm, PHPUnit not found in include path 2 380
MAC and PC - Cheap video editing tools 4 121
NOTEPAD++ Meaning of (+) and (-) Icons 6 102
Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
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 new code templates in NetBeans IDE 8.0 for Windows.

895 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now