Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. TEXTBOX HELP!!!

TEXTBOX HELP!!!

Scheduled Pinned Locked Moved C#
comhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dgap
    wrote on last edited by
    #1

    Hi All, I am trying to do the following in a web control that I am creating: I have a username and password textboxes and a login button. when the user is in the password textbox and if they hit I want either one of the following two behaviours to happen: 1. do nothing, or 2. automatically fire the login button's clicked postback event Right now when a user hits it loses focus from the textbox and does nothing! (If it is doing a postback then what event is it firing!!!) This is driving me crazy! any help would be greatly appreciated! schoudhr@hotmail.com

    D 1 Reply Last reply
    0
    • D dgap

      Hi All, I am trying to do the following in a web control that I am creating: I have a username and password textboxes and a login button. when the user is in the password textbox and if they hit I want either one of the following two behaviours to happen: 1. do nothing, or 2. automatically fire the login button's clicked postback event Right now when a user hits it loses focus from the textbox and does nothing! (If it is doing a postback then what event is it firing!!!) This is driving me crazy! any help would be greatly appreciated! schoudhr@hotmail.com

      D Offline
      D Offline
      dgap
      wrote on last edited by
      #2

      Hi All, I am trying to do the following in a web control that I am creating: I have a username and password textboxes and a login button. when the user is in the password textbox and if they hit "ENTER" I want either one of the following two behaviours to happen: 1. do nothing BUT don't lose focus on the textbox either!, or 2. automatically fire the login button's clicked postback event (#2 is preferable) Right now when a user hits "ENTER" it loses focus from the textbox and does nothing! (If it is doing a postback then what event is it firing!!!) This is driving me crazy! any help would be greatly appreciated! schoudhr@hotmail.com

      S 1 Reply Last reply
      0
      • D dgap

        Hi All, I am trying to do the following in a web control that I am creating: I have a username and password textboxes and a login button. when the user is in the password textbox and if they hit "ENTER" I want either one of the following two behaviours to happen: 1. do nothing BUT don't lose focus on the textbox either!, or 2. automatically fire the login button's clicked postback event (#2 is preferable) Right now when a user hits "ENTER" it loses focus from the textbox and does nothing! (If it is doing a postback then what event is it firing!!!) This is driving me crazy! any help would be greatly appreciated! schoudhr@hotmail.com

        S Offline
        S Offline
        Susan Hernandez
        wrote on last edited by
        #3

        If you are talking about a C# Windows application then here's an idea, may give you a place to start.

        // In your InitializeComponent() method, make sure you've set the event
        // Set the event to catch a keypress from your Password textbox
        this.txtPassword.KeyPress +=
        new System.Windows.Forms.KeyPressEventHandler(this.txtPassword_KeyPress);

        .....

        // The Event Handler
        private void Generic_KeyPress(object sender,
        System.Windows.Forms.KeyPressEventArgs e)
        {
        // When the "Enter" key is pressed, fire your button click event
        // using appropriate arguments, EventArgs.Empty, or null
        if(e.KeyChar == (char)13)
        cmdLogin_ButtonClick(this, EventArgs.Empty);
        }

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups