473,804 Members | 3,057 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I know....

....which control has focus at a given moment?

This is what I want. I have two textboxes in a form: one for vendor
and one for items. Now, if am at the vendor field and I press [F3]
the vendor search form should appear but If I am at the item field It
should show the item search form.
All comments will be appreciated.
Thank you.

Lizard King.
Jul 17 '05 #1
3 2566

"Lizard King" <wi*******@star media.com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
...which control has focus at a given moment?

This is what I want. I have two textboxes in a form: one for vendor
and one for items. Now, if am at the vendor field and I press [F3]
the vendor search form should appear but If I am at the item field It
should show the item search form.
All comments will be appreciated.
Thank you.

Lizard King.


Well, the keyevent that will be triggered will be whereever the focus
happens to be.. for example, assuming you have text1 and text2 textboxes, if
you get into the routine below..

Private Sub Text2_KeyPress( KeyAscii As Integer)
' this means soemone press a key when the focus is in text2
'if KeyAscii = 13 then 'someone press ENTER
End Sub
Jul 17 '05 #2
Me.ActiveContro l

On 22 Aug 2003 08:06:40 -0700, wi*******@starm edia.com (Lizard King)
wrote:
...which control has focus at a given moment?

This is what I want. I have two textboxes in a form: one for vendor
and one for items. Now, if am at the vendor field and I press [F3]
the vendor search form should appear but If I am at the item field It
should show the item search form.
All comments will be appreciated.
Thank you.

Lizard King.


Jul 17 '05 #3
assuming your texboxes are named txtVendor and txtItem

1. set the form's key preview to True.
2. in the form's key down event. add something like:

If Me.ActiveContro l.Name = txtVendor Then
' Code to execute for the On Vendor Situation
ElseIf Me.ActiveContro l.Name = txtItem Then
' Code to Execute for the On Item textbox situation
Else
' Probably wont need an Else in this construct.
End if

You just need to add ElseIf construct with its' corresponding code for any
other control you might want to add a search feature to.

--
Stéphane Richard
Senior Software and Technology Supervisor
http://www.totalweb-inc.com
For all your hosting and related needs

"Lizard King" <wi*******@star media.com> wrote in message
news:df******** *************** ***@posting.goo gle.com...
...which control has focus at a given moment?

This is what I want. I have two textboxes in a form: one for vendor
and one for items. Now, if am at the vendor field and I press [F3]
the vendor search form should appear but If I am at the item field It
should show the item search form.
All comments will be appreciated.
Thank you.

Lizard King.

Jul 17 '05 #4

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

Similar topics

3
3059
by: Robert | last post by:
Python doesn't know the class of a method when container not direct class attribute: >>> class X: .... def f():pass .... g=f .... l= .... >>> X.g <unbound method X.f>
5
2323
by: Michele | last post by:
What does the CIO need to know about Sequel Server administration?
20
2280
by: Simon Harvey | last post by:
Festive greetings fellow programmers! I've been programming now for about 4, maybe 5 years now. 4 of those years were at university so and I havent had much work experience of making real world applications (although I trying to make some now). There is still a lot I don't know when it comes to making programs. I know all the theory, but not how (and why) certain things are done in real world projects. My current ponderings are about...
4
1848
by: Support | last post by:
Hi, I want to know if I have changed a few records in my database using update / insert / delete methods, how can i later know which rows have been changed or modified ? I know the ExecuteNonQuery method which can give me the "number" of modified rows, but which rows are changed how do I know ? Any ideas ?
14
2372
by: J. Makela | last post by:
Hallo. This should be a pretty entertaining question for you *real* javascript writers.. I, being the lowly photoshop guy at an ad agency made the mistake of actually saying "HTML" in a conversation once.. and now I have been tasked with building a big website with LOTS of fancy javascripting. Image rollovers mostly. Only problem is that I don't really know how to do it. Of course, that's of no consequence so I have to do it anyway....
41
6097
by: Nitin Bhardwaj | last post by:
Hi all, I wanted to know whether the stack in a C program is growing upwards or downwards.So I wrote a little code to see that.Please guide me as to whether this code is correct in telling this ? #include <stdio.h> int main(void) {
37
4008
by: jht5945 | last post by:
For example I wrote a function: function Func() { // do something } we can call it like: var obj = new Func(); // call it as a constructor or var result = Func(); // call it as a function
102
5177
by: BoogieWithStu22 | last post by:
I am running into a problem with a web page I have created when viewing it in IE6 on some machines. The page has a database lookup. The user enters an account name or number and clicks a lookup button. This hits an AS400 database looks for matches and returns a dataset that is used to populate a datagrid. The user then selects one of the entries from the list, this entry is used to populate a couple of textboxes on the page and a couple...
3
2256
markmcgookin
by: markmcgookin | last post by:
Hi Folks, I have a VB app, and I have been working at it for a while, and I am now at the stage where I want to create a search function. Now don't be scared! It is in the .Net compact framework, and uses SQL Server CE as the database (This seems to scare off people trying to help! lol) but the connection and reading of data etc is all handled, and I think it is going to be a "relatively" simple function. My database has a number of fields...
5
1669
by: garks | last post by:
Is there any way to know the computer is connected to a router? I know using WebRequest is one of the method, but WebRequest need router's URL , username and password. I don't know those information. Is there any other way to know the existence of router? Thanks.
0
9706
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
9584
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
10337
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
10323
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,...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7622
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
6854
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();...
1
4301
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
2
3822
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.