473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Up Arrow Key

I am using VB6 and Access. i have several text boxes arranged on a form. what is want is that when the focus is in a certain text box and the user presses the up arrow key, the focus goes to the text box before it. How can this be done??? Is there any way in which i can connect all textboxes like a linked list and shift the focus to previous text box on up arrow key press???? or any other way to achieve the same???
Feb 3 '08 #1
5 2368
daniel aristidou
491 256MB
I am using VB6 and Access. i have several text boxes arranged on a form. what is want is that when the focus is in a certain text box and the user presses the up arrow key, the focus goes to the text box before it. How can this be done??? Is there any way in which i can connect all textboxes like a linked list and shift the focus to previous text box on up arrow key press???? or any other way to achieve the same???
You can use tab to change which textbox has focus.....
Feb 3 '08 #2
You can use tab to change which textbox has focus.....

But tab helps the focus to shift on a control with a higher tabindex property. what if i want to go back to some textbox where i already have been but want to go again for some modifications. What we normally do is take the mouse pointer to that text box and click but i want to allow this using keyboard
Feb 3 '08 #3
This works for textbox Text1(0 to X)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
  2.     Static Choose As Integer
  3.     If KeyCode = vbKeyDown Then
  4.         Choose = Index + 1
  5.         If Choose >= Text1.Count Then Choose = 0
  6.         Text1(Choose).SetFocus
  7.     ElseIf KeyCode = vbKeyUp Then
  8.         Choose = Index - 1
  9.         If Choose < 0 Then Choose = Text1.Count - 1
  10.         Text1(Choose).SetFocus
  11.     End If
  12. End Sub
  13.  
Feb 3 '08 #4
Killer42
8,435 Expert 8TB
Nice one Dawoodoz. I suppose you could also try simulating a Tab or BackTab keypress, but your technique is probably cleaner and more reliable.

One thing - I hope these are single-line textboxes, or you may confuse the user.

Another point - mclueless, have you considered using some type of grid control instead of textboxes?
Feb 4 '08 #5
9815402440
180 100+
hi
add following code to keydown event of every text box (if you are not using index array)

Expand|Select|Wrap|Line Numbers
  1. Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
  2.     If KeyCode = vbKeyDown Then
  3.         SendKeys "{TAB}"
  4.     ElseIf KeyCode = vbKeyUp Then
  5.         SendKeys "+({TAB})"
  6.     End If
  7. End Sub

regards
manpreet singh dhillon hoshiarpur
Feb 7 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ataha | last post by:
Is it possible to display an up-arrow in a Label, TextBox, ListView, DataGrid, etc without using a graphic ? I keep trying the characters that should represent arrows and im getting little squares....
8
by: Harry Haller | last post by:
The right arrow in IE is displayed aligned to the bottom of the line. Is there any way I can display it aligned vertially in the middle? Example: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01...
7
by: Seash | last post by:
Hi friends , here is the sample code private void txtbox_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if(e.KeyChar == 13) //enter { txtbox2.Focus(); }
4
by: Neil Wallace | last post by:
Hi there, I have an application in which a grid of 100 or more buttons are put on a form in columns of 10. All the buttons are within a panel. They are added in runtime, and so they adopt a...
11
by: Rlrcstr | last post by:
How can you detect when an arrow key gets pressed? Doesn't seem to trigger a KeyPress or KeyDown event. Thanks. Jerry
2
by: PJ6 | last post by:
When I hit an arrow key, I want to be able to change the focus from cell to cell just like in Excel. I see two ways of doing this. First, emitting in script a function call in each cell on key down...
1
by: Martijn Mulder | last post by:
/* I have problems detecting the Arrow Keys on a User Control. A control derived from System.Windows.Forms.Control neglects 'bare' Arrow Keys but does react on the combination <Altor <Ctrl+ Arrow...
0
by: Martijn Mulder | last post by:
/* I override IsInputKey() to direct the Arrow Keys (Cursor Keys) to my custom System.Windows.Forms.Control. But, holding down the Shift-Key prevents the Arrow Keys from coming through. How can...
4
by: Techhead | last post by:
How can I implement a rising/falling trend arrow based on a number that may rise or fall. For example, if the number (variable) is 100 and changes to 101, the "arrow" changes to "up", if the number...
4
by: beary | last post by:
Hi Being tested using FF 3 on WAMP server. I have spent a number of hours trying to figure this out myself. I have a html form using table cells and had a request to enable the arrow keys on a...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.