Ask a Question related to ASP.NET, Design and Development.

  1. #1

    Default keyDown

    hie again, i have 3 textbox and i would like the user to
    go to the next textbox by pressing the 'ENTER' key. i have
    tried using this:

    Private Sub txtRequestor_KeyDown(ByVal sender As
    System.Object, ByVal e As
    System.Windows.Forms.KeyEventArgs) Handles
    txtRequestor.KeyDown
    If e.KeyCode = Keys.Enter Then
    SendKeys.Send("{TAB}")
    End If
    End Sub

    The coding produces these errors:
    1. Event 'keyDown' cannot be found
    2. Name 'Keys' is not declared
    3. Name 'SendKeys' is not declared

    what us the cause of my problem? do i have to add in other
    reference (i have already added System.Windows.Forms) so
    that the keyDown event can be found? or is there another
    way to do this?

    Thanx!

    Anne Guest

  2. Similar Questions and Discussions

    1. Keydown does not register if W3D on stage
      I have a 3D model made in Max which i've imported into Director MX 2004. I have made loads of custom script to interact with the model using the...
    2. Problem with Keydown and S3D
      Hello everybody, I use On keyDown event in a movie script and it works well until I put a shockwave 3d sprite on the stage. The event is then no...
    3. Sound on keydown
      hi, um... im having a bit of trouble with director at the moment, i have posted on other forums and had some useful replies, but being a beginner...
    4. keyDown: in NSMatrix subclass
      In <znu-55B7B3.11560309072003@news.fu-berlin.de> ZnU wrote: I presume you remembered to dick around with acceptsFirstResponder? When that...
    5. keyDown & keyUp?????
      Can anyone tell me why the keyDown and keyUp handlers don't work when SW3D is inserted in a movie. chartonum(the keypressed) works, but that...
  3. #2

    Default Re: keyDown

    You must not be using Internet Explorer for your browser.

    HTH,

    Kevin Spencer
    Microsoft FrontPage MVP
    Internet Developer
    [url]http://www.takempis.com[/url]
    Some things just happen.
    Everything else occurs.

    "Anne" <lilanne_2@yahoo.com> wrote in message
    news:035f01c3446a$61fc6960$a001280a@phx.gbl...
    > hie again, i have 3 textbox and i would like the user to
    > go to the next textbox by pressing the 'ENTER' key. i have
    > tried using this:
    >
    > Private Sub txtRequestor_KeyDown(ByVal sender As
    > System.Object, ByVal e As
    > System.Windows.Forms.KeyEventArgs) Handles
    > txtRequestor.KeyDown
    > If e.KeyCode = Keys.Enter Then
    > SendKeys.Send("{TAB}")
    > End If
    > End Sub
    >
    > The coding produces these errors:
    > 1. Event 'keyDown' cannot be found
    > 2. Name 'Keys' is not declared
    > 3. Name 'SendKeys' is not declared
    >
    > what us the cause of my problem? do i have to add in other
    > reference (i have already added System.Windows.Forms) so
    > that the keyDown event can be found? or is there another
    > way to do this?
    >
    > Thanx!
    >

    Kevin Spencer Guest

  4. #3

    Default Re: keyDown

    he must be using a BROWSER!

    there is no such event for a text box in Asp.Net.

    and the reference to SYSTEM.WINDOWS.FORMS is really puzzling. Is this a WEB
    project (that's what this N.G. is for) or is this a desk-top application?

    "Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
    news:#lo8$QIRDHA.1564@TK2MSFTNGP12.phx.gbl...
    > You must not be using Internet Explorer for your browser.
    >
    > HTH,
    >
    > Kevin Spencer
    > Microsoft FrontPage MVP
    > Internet Developer
    > [url]http://www.takempis.com[/url]
    > Some things just happen.
    > Everything else occurs.
    >
    > "Anne" <lilanne_2@yahoo.com> wrote in message
    > news:035f01c3446a$61fc6960$a001280a@phx.gbl...
    > > hie again, i have 3 textbox and i would like the user to
    > > go to the next textbox by pressing the 'ENTER' key. i have
    > > tried using this:
    > >
    > > Private Sub txtRequestor_KeyDown(ByVal sender As
    > > System.Object, ByVal e As
    > > System.Windows.Forms.KeyEventArgs) Handles
    > > txtRequestor.KeyDown
    > > If e.KeyCode = Keys.Enter Then
    > > SendKeys.Send("{TAB}")
    > > End If
    > > End Sub
    > >
    > > The coding produces these errors:
    > > 1. Event 'keyDown' cannot be found
    > > 2. Name 'Keys' is not declared
    > > 3. Name 'SendKeys' is not declared
    > >
    > > what us the cause of my problem? do i have to add in other
    > > reference (i have already added System.Windows.Forms) so
    > > that the keyDown event can be found? or is there another
    > > way to do this?
    > >
    > > Thanx!
    > >
    >
    >
    >

    David Waz... Guest

  5. #4

    Default Re: keyDown

    Hi Anne,

    Yes, there is an onkeydown event for a text box. However, it is not on the
    server side. It is on the client side, in the browser. The problem is that
    you can't send keys through the browser interface programmatically. It just
    isn't safe, and I don't expect that you ever will be able to. A hostile web
    site could type any combination of keys on a client computer if that was so.

    I mistakenly thought that you had written a client-side event handler there,
    as it looks a lot like one for Internet Explorer (should have looked more
    carefully). If this is a server-side event handler, you're barking way up
    the wrong tree there. The good news is, you can get the effect you want on
    the client side without a PostBack, and without having to use the client
    keyboard. While the TAB key moves the focus to the next form field in most
    browsers, you can use the JavaScript focus() method to set the focus on any
    form element you wish. So, what you really need is a client-side event
    handler that captures the ENTER key and sets the focus on the form element
    you desire. However, be advised that this is not standard browser behavior,
    and therefore may be contrary to the way that people expect their browser to
    behave. Here is an example:

    <script type="text/javascript"><!--
    function GetEnter()
    {
    if (event.keyCode == 13) document.forms[0].elementName.focus();
    }
    // --></script>

    "elementName" is the name attribute of the form element you want to shift
    the focus to.

    In Your textbox, just add an "onkeydown" event handler. Example:

    <input type="text" name="myText" size="20" onkeydown="GetEnter()">

    HTH,

    Kevin Spencer
    Microsoft FrontPage MVP
    Internet Developer
    [url]http://www.takempis.com[/url]
    Some things just happen.
    Everything else occurs.

    "Anne" <lilanne_2@yahoo.com> wrote in message
    news:0f2601c344ea$fe62f500$a001280a@phx.gbl...
    > hie david, yes, this is a web project. but i am trying 2
    > integrate that keyDown event from the system.windows.forms.
    > are u sure there's no such thing for a textbox in asp.net?
    > anybody else have any idea on how i can use similar
    > function as the keyDown?
    >
    > thanx 4 all the help!
    >
    > >-----Original Message-----
    > >he must be using a BROWSER!
    > >
    > >there is no such event for a text box in Asp.Net.
    > >
    > >and the reference to SYSTEM.WINDOWS.FORMS is really
    > puzzling. Is this a WEB
    > >project (that's what this N.G. is for) or is this a desk-
    > top application?
    > >
    > >"Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in
    > message
    > >news:#lo8$QIRDHA.1564@TK2MSFTNGP12.phx.gbl...
    > >> You must not be using Internet Explorer for your
    > browser.
    > >>
    > >> HTH,
    > >>
    > >> Kevin Spencer
    > >> Microsoft FrontPage MVP
    > >> Internet Developer
    > >> [url]http://www.takempis.com[/url]
    > >> Some things just happen.
    > >> Everything else occurs.
    > >>
    > >> "Anne" <lilanne_2@yahoo.com> wrote in message
    > >> news:035f01c3446a$61fc6960$a001280a@phx.gbl...
    > >> > hie again, i have 3 textbox and i would like the user
    > to
    > >> > go to the next textbox by pressing the 'ENTER' key. i
    > have
    > >> > tried using this:
    > >> >
    > >> > Private Sub txtRequestor_KeyDown(ByVal sender As
    > >> > System.Object, ByVal e As
    > >> > System.Windows.Forms.KeyEventArgs) Handles
    > >> > txtRequestor.KeyDown
    > >> > If e.KeyCode = Keys.Enter Then
    > >> > SendKeys.Send("{TAB}")
    > >> > End If
    > >> > End Sub
    > >> >
    > >> > The coding produces these errors:
    > >> > 1. Event 'keyDown' cannot be found
    > >> > 2. Name 'Keys' is not declared
    > >> > 3. Name 'SendKeys' is not declared
    > >> >
    > >> > what us the cause of my problem? do i have to add in
    > other
    > >> > reference (i have already added System.Windows.Forms)
    > so
    > >> > that the keyDown event can be found? or is there
    > another
    > >> > way to do this?
    > >> >
    > >> > Thanx!
    > >> >
    > >>
    > >>
    > >>
    > >
    > >
    > >.
    > >

    Kevin Spencer Guest

  6. #5

    Default Re: keyDown


    hie kevin,
    thanx 4 the reply, and yes, at the time i was reading ur
    explanation and solution, i was able to find another
    solution similar to yours using javascript thanx once
    again!
    >-----Original Message-----
    >Hi Anne,
    >
    >Yes, there is an onkeydown event for a text box. However,
    it is not on the
    >server side. It is on the client side, in the browser.
    The problem is that
    >you can't send keys through the browser interface
    programmatically. It just
    >isn't safe, and I don't expect that you ever will be able
    to. A hostile web
    >site could type any combination of keys on a client
    computer if that was so.
    >
    >I mistakenly thought that you had written a client-side
    event handler there,
    >as it looks a lot like one for Internet Explorer (should
    have looked more
    >carefully). If this is a server-side event handler,
    you're barking way up
    >the wrong tree there. The good news is, you can get the
    effect you want on
    >the client side without a PostBack, and without having to
    use the client
    >keyboard. While the TAB key moves the focus to the next
    form field in most
    >browsers, you can use the JavaScript focus() method to
    set the focus on any
    >form element you wish. So, what you really need is a
    client-side event
    >handler that captures the ENTER key and sets the focus on
    the form element
    >you desire. However, be advised that this is not standard
    browser behavior,
    >and therefore may be contrary to the way that people
    expect their browser to
    >behave. Here is an example:
    >
    ><script type="text/javascript"><!--
    >function GetEnter()
    >{
    > if (event.keyCode == 13) document.forms
    [0].elementName.focus();
    >}
    >// --></script>
    >
    >"elementName" is the name attribute of the form element
    you want to shift
    >the focus to.
    >
    >In Your textbox, just add an "onkeydown" event handler.
    Example:
    >
    ><input type="text" name="myText" size="20"
    onkeydown="GetEnter()">
    >
    >HTH,
    >
    >Kevin Spencer
    >Microsoft FrontPage MVP
    >Internet Developer
    >[url]http://www.takempis.com[/url]
    >Some things just happen.
    >Everything else occurs.
    >
    >"Anne" <lilanne_2@yahoo.com> wrote in message
    >news:0f2601c344ea$fe62f500$a001280a@phx.gbl...
    >> hie david, yes, this is a web project. but i am trying 2
    >> integrate that keyDown event from the
    system.windows.forms.
    >> are u sure there's no such thing for a textbox in
    asp.net?
    >> anybody else have any idea on how i can use similar
    >> function as the keyDown?
    >>
    >> thanx 4 all the help!
    >>
    >> >-----Original Message-----
    >> >he must be using a BROWSER!
    >> >
    >> >there is no such event for a text box in Asp.Net.
    >> >
    >> >and the reference to SYSTEM.WINDOWS.FORMS is really
    >> puzzling. Is this a WEB
    >> >project (that's what this N.G. is for) or is this a
    desk-
    >> top application?
    >> >
    >> >"Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote
    in
    >> message
    >> >news:#lo8$QIRDHA.1564@TK2MSFTNGP12.phx.gbl...
    >> >> You must not be using Internet Explorer for your
    >> browser.
    >> >>
    >> >> HTH,
    >> >>
    >> >> Kevin Spencer
    >> >> Microsoft FrontPage MVP
    >> >> Internet Developer
    >> >> [url]http://www.takempis.com[/url]
    >> >> Some things just happen.
    >> >> Everything else occurs.
    >> >>
    >> >> "Anne" <lilanne_2@yahoo.com> wrote in message
    >> >> news:035f01c3446a$61fc6960$a001280a@phx.gbl...
    >> >> > hie again, i have 3 textbox and i would like the
    user
    >> to
    >> >> > go to the next textbox by pressing the 'ENTER'
    key. i
    >> have
    >> >> > tried using this:
    >> >> >
    >> >> > Private Sub txtRequestor_KeyDown(ByVal sender As
    >> >> > System.Object, ByVal e As
    >> >> > System.Windows.Forms.KeyEventArgs) Handles
    >> >> > txtRequestor.KeyDown
    >> >> > If e.KeyCode = Keys.Enter Then
    >> >> > SendKeys.Send("{TAB}")
    >> >> > End If
    >> >> > End Sub
    >> >> >
    >> >> > The coding produces these errors:
    >> >> > 1. Event 'keyDown' cannot be found
    >> >> > 2. Name 'Keys' is not declared
    >> >> > 3. Name 'SendKeys' is not declared
    >> >> >
    >> >> > what us the cause of my problem? do i have to add
    in
    >> other
    >> >> > reference (i have already added
    System.Windows.Forms)
    >> so
    >> >> > that the keyDown event can be found? or is there
    >> another
    >> >> > way to do this?
    >> >> >
    >> >> > Thanx!
    >> >> >
    >> >>
    >> >>
    >> >>
    >> >
    >> >
    >> >.
    >> >
    >
    >
    >.
    >
    Anne Guest

  7. #6

    Default keydown

    Hello,
    I am creating a software simulation and need to create a script which will advance the movie by 10 frames from the current frame, when an F button is pressed.
    Seems simple enough but can't seem to follow the syntax.



    malta2 webforumsuser@macromedia.com Guest

  8. #7

    Default keydown

    I use director mx 2004.
    In a frame script, after handler "on exit frame" i used a "oh keydown" handler
    but it did not work! and when i changed it to a "on keyup" handler it worked.
    Who can explain me why?

    My scripts are very simple:

    on exitframe me
    go the frame
    end
    on keydown()
    case (_key.keyCode) of
    6:
    zoomin--z
    7:
    zoomout--x
    end case
    end

    I am using these in stead of that codes, it works but i dont want use
    exitframe handler:

    on exitframe me
    go the frame
    if (_key.keyPressed(6)) then zoomin
    if (_key.keyPressed(7)) then zoomout
    end

    Aghamahdi Guest

  9. #8

    Default Re: keydown

    w3d sprites seem to muck up key events, see [url]http://www.macromedia.com/cfusion/webforums/forum/messageview.cfm?catid=268&threadid=1112648&highlig ht_key=y&keyword1=keydown[/url] for some fixes.
    Ex Malterra Guest

  10. #9

    Default Re: keydown

    Thanks a lot
    You saved my time.

    MJ.A
    Aghamahdi Guest

  11. #10

    Default keyDown

    Hi all,

    I'm wondering about the keyboard functionalities.
    I'd like to catch the event "I press a key". it works fine in a TextInput
    component, but I want to do that in all my application.
    and the function keyDown doesn't seem to work...

    Have you got any idea?

    Here is a code which would be working but is not, it never goes in my
    function...
    ps: I've tried with an addeventlistener, I have the same result, nothing is
    working!


    /***************************************

    <?xml version="1.0" ?>
    <mx:Application keyDown="keyDownHandlerCustom()"
    xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"
    viewSourceURL="srcview/index.html">

    <mx:Script>
    <![CDATA[
    import flash.events.*;

    private function keyDownHandlerCustom():void
    {
    trace("keyDown");
    }
    ]]>
    </mx:Script>

    </mx:Application>

    kopir Guest

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139