473,750 Members | 2,253 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#-FORM Way to reference textbox that holds cursor?

7 New Member
I'm writing a function to cut the information out of a textbox when a button is pressed. There are many textboxes on the form, and I only want to cut the information in the box that has the cursor. I really don't want to look for the cursor in each textbox in each level of the form.

Is there a way to reference the "current" textbox?

Thanks,
NT
Sep 22 '08 #1
3 1517
Plater
7,872 Recognized Expert Expert
Well, when you click a button, the cursor LEAVES the textbox it was in, making NO textbox the current textbox. So you might want to re-think how you do that.

Possibly using the onFocus() and onBlur() events in javascript?
Sep 22 '08 #2
ntabb
7 New Member
Good point. I'm looking into the onFocus now....
Sep 22 '08 #3
tlhintoq
3,525 Recognized Expert Specialist
Maybe keep a tracking variable. At each TextBox Focus Enter event update the tracking variable to the new TextBox control. Then when you hit the magic key, even if you leave the TextBox in question you will still know which control last held the focus.

All the TextBoxes can go to the same event handler with something like
Control myTracker = (Control)sender ;
Sep 22 '08 #4

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

Similar topics

2
125413
by: Ant | last post by:
Ok, so I have a regular input textbox on my webpage and I'm trying to work out how to make it so when the user presses a button the the textbox holds the value of a variable. I just can't work out how to do this. any help much appreciated
5
1348
by: Manco | last post by:
Is it true that: 1. inside a method, value-type variables and reference-type variables are all on the stack 2. the value-type variable is on the stack, but the reference points to a memory address in the heap
0
1004
by: Scott | last post by:
I have a textbox to enter an email address followed by a password textbox. The email has a regularexpressionvalidator and a requiredfieldvalidator. The ReqField works fine, but if I put in an invalid email addy then click in the password field below, something very odd happens. The password label & textbox (and all controls below) shift down one line, and rather than having my cursor in the password textbox. The cursor is IN the...
1
3160
by: Marc Robitaille | last post by:
Hello I build a usercontrol. On this new control, I added two controls, a TextBox and a ComboBox. My ComboBox is filled with a DataTable. When the user types something in the TextBox, I apply a filter to the DataView of the DataTable of my ComboBox. If there is more than one element, I dropdown the list. If I have one element, it is automatically selected. My problem is that the cursor works badly. When I type for the first time in...
3
38869
by: luanhoxung | last post by:
Hi all !! i have met trouble with referring textbox of subform in VBA i know i can do as: forms!mainform.subform.textbox but i want do it in shorter path. any suggestion about using variable ? Pls help me !! many with thanks !
0
1640
by: AboutJAV | last post by:
Hi, I am dragging a treenode from the treeview to the rich textbox. I inserted debug message and I do the treeview selection drag event is trigged and when I drag the item to the textbox, it triggers the textboxArea_dragEnter. After the I let go of the mouse, nothing happens. When I click to select the tree node, the cursor turns to a circle with the ban cross. When I drag it to the textbox, the cursor does no change when I drop it to...
5
8509
by: michels287 | last post by:
Right now I have a touchscreen with a virual keyboard. I would like to create arrow keys. If the user messed up the inputted text, he can move the blinking cursor left one space at a time between inputted characters to add a letter. Then a button to move the blinking cursor back to the end of the inputted text. Private Sub Left Arrow_Click() If Text1.SelStart Then Text1.SelStart = Text1.SelStart - 1 Text1.SetFocus End Sub Private...
3
3995
by: geosmy | last post by:
Hi everyone, Is it possible to highlight (a portion of the) text in a textbox without setting focus to it. What I'm interested is marking some portion of the text for reference while my cursor is still inside some other control.
1
6782
by: vituko | last post by:
plpgsql (postgresql 8.3 but I can upgrade) I can open a cursor with a dynamic query (table / column variable) : -open cursor for execute '...' ; But if I want do updates... - execute 'update ...' where current of cursor ?? Mmm I don't find the way. Another approach :
0
8999
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
9575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9338
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
9256
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...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4712
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
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.