VB.net Enter Key
Posted
by Andrew
on Stack Overflow
See other posts from Stack Overflow
or by Andrew
Published on 2010-06-11T13:16:51Z
Indexed on
2010/06/11
13:42 UTC
Read the original article
Hit count: 245
I was given the following pseudo code in order to get the form that has focus and only allow the form I want to be submitted:
<script> var currentForm = document.forms[0];</script>
<form ...><input onfocus="currentForm = this.form;"/></form>
<form ...><input onfocus="currentForm = this.form;"/></form>
function globalKeyPressed(event) {
if (event.keyCode == ENTER) { // This is pseudo-code, check how to really do it
currentForm.submit();
}
}
How would I do this for VB.net because VB.net doesn't accept System.Windows.Forms.KeyPressEventArgs. I also wanted to add that I can't have multiple forms on my website as it disrupts the loginview. So my 2 seperate 'forms' are really just a loginview and then an asp:textbox and asp:button by themselves without a form.
© Stack Overflow or respective owner