473,326 Members | 2,108 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,326 software developers and data experts.

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

7
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 1493
Plater
7,872 Expert 4TB
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
Good point. I'm looking into the onFocus now....
Sep 22 '08 #3
tlhintoq
3,525 Expert 2GB
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
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...
5
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...
0
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...
1
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...
3
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 ?...
0
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...
5
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...
3
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...
1
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...
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...
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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.