473,831 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1784
"Vayse" <va***@nospam.n ospam> 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.GetNex tControl' 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.selectn extcontrol

or

SelectNextContr ol(Me.ActiveCon trol, True, True, True, True)

Good Luck
Chris
Dec 15 '05 #3
Addendum:

.... or even shorter, use 'Control.Select NextControl' directly. The current
control can be obtained using 'Me.ActiveContr ol'.

--
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.GetNextContr ol(Button1, True)
control.Focus()

"Vayse" <va***@nospam.n ospam> wrote in message
news:%2******** *******@TK2MSFT NGP12.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
2911
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 circumstances in which the STL will move a vector, or invalidate iterators to elements in the vector, if you don't insert or remove elements? My actual problem seems to be as follows: I have class X, which contains an STL vector. The constructor...
6
14721
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 entering data into a form to get the cursor to move to the next control after I press the Enter key? Terry
4
9536
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 pages (one page at the end for collecting identifying information) on my form. To ease the task for the user, I'd like to have an automatic movement to the next page. For instance, when the user clicks on the choice for Question 4 (the last of...
2
8804
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. Regards Anand Ganesh
10
3101
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 config does specify a machinekey setting: <machineKey validationKey="447C05E8B3A71401CC4CAE5513A7F1A3494A3618EE819316AAD1D58433F236A759D66FB4154500E01EB4E1BC1DE42046E2D652D391CB8367A1649438867A02EB"...
2
3606
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 key or the RETURN key. How can that be down ??
3
5465
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 users if it's ok to delete. Thanks in advance. i found one that was really close but it only looks at one folder. I need it to look at files within folders and subfolders too. Dim oFSO, wshShell, FileCol, oFolder, objTextFile, shareLength,...
4
1769
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 to move to the next/ previous record. (regardless of whether or not the subfrm is dirty).
5
22323
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 of them, I want to programmatically move the user to the next textbox in the sequence. Right now I'm using sendkeys to send the tab character, but there's just something about it I don't like...it seems kind of hokey. Is there a managed function...
0
9794
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10496
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10538
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.