.Net Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - More.Net Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 11th, 2003, 07:28 PM
OneDigitIQ OneDigitIQ is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 2 OneDigitIQ User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How do you have the cursor advance to the next input field when the user hits <ENTER>

How do you have the cursor advance to the next input field when the user hits <ENTER> in VB.NET

I would appreicate any help. Thank you in advance..!

Reply With Quote
  #2  
Old October 12th, 2003, 05:46 PM
oni9 oni9 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Brisbane, Australia
Posts: 50 oni9 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 10
Not so sure in VB.NET, I use C# more often. However, the concept should be same.

This is how I would do it:
I would write a KeyPressEventHandler to handle the controls (input fields) which need to have the "Enter" key as the tab key.

Code:
Control_KeyPress(object sender, KeyPressEventHandler e){
  if(e.KeyChar!=Keys.Enter){
    return; //skip all keys except Enter
  }

    //for tab index sorting
  int currentIndex = ((Control)sender).TabIndex;
  int nextIndex = 5000; // for tab index sorting

  Control controlToFocus = null;
  foreach(Control c in this.Controls){
    if((c.TabIndex<nextIndex)&&c.TabIndex>currentIndex)){
      if(c.TabStop){
        nextIndex = c.TabIndex;
        controlToFocus = c;
      }
    }
  }

  if(controlToFocus !=null){
    controlToFocus.Focus();
  }
}



hope it helps

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - More.Net Development > How do you have the cursor advance to the next input field when the user hits <ENTER>

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap