Hi All,
in my form I have two textboxes (T1,T2) and two buttons (B1,B2)
how can i insert text in T1 and press enter to execute B1 event, and insert text in T2 and press enter to execute B2 event.
the only thing that i found is that I set in the Form itself the property of AcceptButton and choose which button (only one button)
is there away for doing so? (i know it is possible but need help :) )
Regards,
HK
5 1446
I think you would have to use the keydown event of the form and in that even check which textbox is set to focus, and raise the appropriate event accordingly
I guess ur application is windows based.
U have to capture key event and then fire particular button click event
Hi All,
in my form I have two textboxes (T1,T2) and two buttons (B1,B2)
how can i insert text in T1 and press enter to execute B1 event, and insert text in T2 and press enter to execute B2 event.
the only thing that i found is that I set in the Form itself the property of AcceptButton and choose which button (only one button)
is there away for doing so? (i know it is possible but need help :) )
Regards,
HK
Double click T1 (textbox) and open the keypress event then use code such as: -
if asc(e.keychar) = "13" then
-
B1.performclick
-
end if
-
You see the asci code for enter key is "13"
Everytime a key is pressed when the textbox is in focus it will check to see if it was the enter key.
Thanks all..it worked with both of the solutions.
:)
Hello
U Can -
Call Like this
-
B1_Click(DBNull.Value, EventArgs.Empty)
-
or
-
Like Jamesed
-
-
B1.PerformClick
-
-
Hi All,
in my form I have two textboxes (T1,T2) and two buttons (B1,B2)
how can i insert text in T1 and press enter to execute B1 event, and insert text in T2 and press enter to execute B2 event.
the only thing that i found is that I set in the Form itself the property of AcceptButton and choose which button (only one button)
is there away for doing so? (i know it is possible but need help :) )
Regards,
HK
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: JCO |
last post by:
How's come when I press the enter key, I can't get it to execute the correct
password.
It seems that I'm forced to press the button. I want to be able to do both.
How is this done?
|
by: Dan |
last post by:
Consider a simple form with a textbox and button.
Is there a way to handle the common situation where a user presses "return"
rather than clicks on the button.
I can already detect the "return" key press using the textbox's onkeypress
event and now what I'm looking for is something like:
onkeypress="if 'return' key pressed, then button.click=True"
|
by: Andrea Williams |
last post by:
I've created a simple search form and a submit button. On click of the
button, I have code-behind that runs and fills a datagrid. However, it the
person is focused on one of the other controls and presses the "Enter"
button, my submit button event code doesn't fire so my datagrid is either
empty, or it shows a lot of blank rows. It looks like the submit happened,
but since my code to fill the datagrid is in the submit_click method, it's...
|
by: guoqi zheng |
last post by:
In a regular html form, when user press "enter" key, the form will be
submitted.
However, in ASP.NET web form, a form will only be submitted (post back) when
a special button is clicked. Many user get used to click "enter" key to
submit a form. How can I use "enter" key to submit/postback in ASP.NET.
Thank,
Guoqi Zheng
|
by: almurph |
last post by:
Hi everyone,
I'm a newbie to javascript. I have written some code to detect when a
user presses the down-arrow, up-arrow and enter button. Essentially
the user can arrow down or up through a list and the textbox is
populated with the option when the user presses the enter button. This
is for a VB.NET Web form type project.
The problem is that when I press the enter button the entire form get
| |
by: Greoasy |
last post by:
I have a registration page with no of text boxes and 3 buttons for
insert update and delete. and a logout button on the top of the page.
If i place my control in an of the text box and press enter key it
automatically goes to the logout button and it logouts.
Actually when i press the enter key it should avctivate either of the
insert,update and delete buttons whchever is active.
Please let me know how to do this?
How can i overcome this...
|
by: daonho |
last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of two text boxes and two button. When ever a key is press on textbox one, I want to trigger...
|
by: arpitwcc |
last post by:
i am making u user login page where there are few buttons at the top of the page like Home, Services, About Us etc
and below it i hav
Username -- textbox
Password --textbox
Login --image button...
now after a user hav filled the password box and when he press the enter key then the 'Login' should fire..... but this button is not firing in my case....
the first button is fired i.e Home button is fired...
|
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...
|
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...
|
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,...
| |
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...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |