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.