473,608 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I insert a char into the textfield on the keydown event of another textfield?

4 New Member
How do I insert a char into the textfield on the keypress event of another textfield?

I have two textboxes, "text1" and "text2".

[COLOR=DarkRed]Important:[/COLOR]
"text1" is outside the table.
"text2" is inside the table cell.

On the keydown/keypress/keyup event of "text1", the character which I entered in the "text1" must display in the textfield "text2".

Sample Code:
[HTML]<input type="text" name="text1" onkeypress="wri te(this)">
<table> //This is a dynamically generated table
<tr>
<td><input type="text" name="text2"></td>
</tr>
</table>
[/HTML]
For example,
Suppose If I enter srsh in "text1", "text2" should display the same.
At the same time, If I enter 'u' in between 's' and 'r' and 'e' in between 'r' and the second 's' in "text1", "text2" should now display "suresh".

And I want to know one more thing?
How can I get the position of the cursor of the textfield "text1"?
How can I set the position of the cursor of the textfield "text2"?

Can anyone please help me?

Regards,
Suresh.
Oct 24 '05 #1
1 3171
acoder
16,027 Recognized Expert Moderator MVP
Just set the value of the first text box to the second one:
Expand|Select|Wrap|Line Numbers
  1. var form = text1.form;
  2. var text2 = form.text2;
  3. text2.value = text1.value;
Oct 1 '07 #2

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

Similar topics

3
6939
by: Frank T. Clark | last post by:
How do I redirect or capture keydown events in a parent form from a child form? I have a main form which displays another informational form marked "SizableToolWindow". Form child = new ChildForm(); this.AddOwnedForm (child);
3
9212
by: bardo | last post by:
I have a Datagrid that is inside a panel. I want to use the keyDown event to reconize the arrow keys. But I have no luck at all. The problem is that the keydown event won't fire at all, unless I click on a row (withs will turn blue then) and then click on it again . Now if I press any key the event will fire (except for the arrow keys). I also tried to override the IsInputKey => no luck. I also tried to override the ProcessCmdKey => With...
5
8007
by: Flip | last post by:
I'm trying to create a form which a user can type out a key, and the CTRL-ALT-SHIFT keys are recognized (via ModifiedKeys object) and then pass the letter the user pressed to the windows API method for setting the hotkey. My problem is that WIN API takes a Keys object/enumeration. I'm a bit weak on that stuff, so I'm hoping someone can point me in the right direction? I'm looking for a good link or just out right help, please? If I...
4
8617
by: Anne | last post by:
hie again, i have 3 textbox and i would like the user to go to the next textbox by pressing the 'ENTER' key. i have tried using this: Private Sub txtRequestor_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtRequestor.KeyDown If e.KeyCode = Keys.Enter Then SendKeys.Send("{TAB}")
3
5243
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the handler does not see the combination. Now this control is contained within another control which is contained within another. The top most control does see the CTRL+Z. I can easily pass down the key info, but why does the nested control see...
3
3376
by: jimmy | last post by:
Hi all I am making a program whereby when the insert key is pressed in a text box it opens up another form with the search parameters they entered in the text box and automatically searches for the data. I have the code below however it does not work when i press the insert key. I have tried it with the enter key Ascii code 13 and all works fine! Is it something to do with Insert being a system/bios key? My code is below; Private Sub...
2
2567
by: Tarik Monem | last post by:
OK! I've gone through a few tutorials and I cannot understand what I'm doing wrong casting_registration.php <table> <tr> <td> <form enctype="multipart/form-data" action="thankyou.php" method="post" name="registrationform"> Choose a shows:
2
1497
by: rsdev | last post by:
Hi, I have a stored procedure which is returning a blank id. Here's my code; SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings); SqlCommand cmd = new SqlCommand("NewComponent", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@shortDescription", SqlDbType.VarChar).Value = Editor1.Text;
2
1937
by: sush_jd via DotNetMonster.com | last post by:
I am using managed VC++ code in a Win Form App. There is a text box - txtRONumber. I have defined a KeyDown event handler (non-default) for it, like below. InitializeComponent() is being called from Constructor of the Form Class. void InitializeComponent(void) { this->txtRONumber = (gcnew System::Windows::Forms::TextBox()); this->txtRONumber->Location = System::Drawing::Point(151, 35);
0
8069
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
8011
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
8358
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
6826
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...
1
6017
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
5482
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
4036
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2479
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
0
1339
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.