Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 875619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:17:59+00:00 2026-05-15T11:17:59+00:00

I was given the following pseudo code in order to get the form that

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:18:00+00:00Added an answer on May 15, 2026 at 11:18 am

    The above looks like a javascript function done on the client side, not a server side event. If that is the case then there will be no difference in VB.NET because it will also use Javascript as the client side language.

    All you’ll need to do is hook up a client side click event to your button and run the code as you’ve been given, changing it to (off of the top of my heaD)

    if (event.keyCode == 13){
      //Submit form.
    }
    

    You could add the client side click by using attributes.add on the Page_Load event of your form, something like:

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          textbox1.attributes.add("onKeyUp", "globalKeyPressed")
    End Sub 
    

    This would then cause the globalKeyPressed() event to be called from your textbox whenever the key is pressed. The globalKeyPressed() event will then cause the current form to be submitted.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following piece of (pseudo-C++) code: float x=100, a=0.1; unsigned int height =
I have a long number. Now what I want is following (given in pseudo
I have a long number. Now what I want is following (given in pseudo
Given the following code: $(.force-selection).blur(function() { var value = $('matched-item').val(); //check if the input's
Given the following code: final class retVal { int photo_id; } Gson gson =
Given the following code: function Person(firstName, lastName) { this.FirstName = firstName; this.LastName = lastName;
Thinking of a way how to best approach the following design (pseudo C++ code):
I'm using Django/Python, but pseudo-code is definitely acceptable here. Working with some models that
Given the following code: public class Outer { public final int n; public class
The following is pseudo code for Kruskal's Minimum Spanning Tree algorithm from our CS

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.