473,322 Members | 1,241 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,322 software developers and data experts.

Move to the next control

I have a text box, with a command button next to it. When the button is
pressed, I want to run some code.
Then pass the focus to the next control.
How do I do this?

Thanks
Vayse
Dec 15 '05 #1
4 1753
"Vayse" <va***@nospam.nospam> schrieb:
I have a text box, with a command button next to it. When the button is
pressed, I want to run some code.
Then pass the focus to the next control.


Determine the next control using 'Control.GetNextControl' and then call the
control's 'Focus' method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 15 '05 #2
Vayse wrote:
I have a text box, with a command button next to it. When the button is
pressed, I want to run some code.
Then pass the focus to the next control.
How do I do this?

Thanks
Vayse


Did you have a look at Tomb's post right before yours?
Two simple ways:
button1.selectnextcontrol

or

SelectNextControl(Me.ActiveControl, True, True, True, True)

Good Luck
Chris
Dec 15 '05 #3
Addendum:

.... or even shorter, use 'Control.SelectNextControl' directly. The current
control can be obtained using 'Me.ActiveControl'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Dec 15 '05 #4
This is what you probably want to do, very simple.

Dim control As New Control
control = Me.GetNextControl(Button1, True)
control.Focus()

"Vayse" <va***@nospam.nospam> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I have a text box, with a command button next to it. When the button is
pressed, I want to run some code.
Then pass the focus to the next control.
How do I do this?

Thanks
Vayse

Dec 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Richard Thompson | last post by:
I've got a memory overwrite problem, and it looks as if a vector has been moved, even though I haven't inserted or deleted any elements in it. Is this possible? In other words, are there any...
6
by: Terry | last post by:
I have a form which is displayed in Datasheet View and would prefer it if, when entering data, I could use the keyboard as I would when entering data into a Datasheet. Is it possible when...
4
by: Vincent Yang | last post by:
I'm using Access 2002. My database is in Access 2000 format. I'm designing a form to collect responses to a 40-item questionnaire. I can fit four list boxes on a screen, so I plan to have 11 tab...
2
by: Anand Ganesh | last post by:
Hi All, How to Implement Move Next, Move Previous, Last Record and First Record in a DataGrid Control ? Is there any standard tool available in the tool box button? Thanks for your time. ...
10
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
2
by: Peter Stojkovic | last post by:
I need a idea how to program the following. I have a control inherited from textbox. The differnce should be, that the cursor will move to the next control , when the user presses the TAB...
3
by: jaeden99 | last post by:
I was wandering if nyone has a script to move files older than x days old? i've seen several to delete, but I don't want to delete. I would like to create a backup of the files first verify with...
4
by: pgcn | last post by:
Hi Using A2003 My db has main form with stakeholderID & other main details. When there are a number of detail subform records it often requires two clicks of the next/previous nav buttons...
5
balabaster
by: balabaster | last post by:
How do you programmatically shift focus to the next tab stop? i.e. I have a bunch of textboxes that all have their tab orders set in sequence. The user hits enter as they finish entering data in any...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...

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.