Results 1 to 4 of 4

Thread: Stupid questions

  1. #1

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    Stupid questions

    OK I have an text box and a botton on a form click the button and it does what it needs to do however i would like to allow it to also do this

    User inputs some text and then presses enter and it calls a function

    How the hell do u code for the enter button
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    Code:
    <html>
       <head>
          <link rel="stylesheet"href="intro.css">
       </head>
    
       <script language="VB" runat=server>
    
           Sub SubmitBtn_Click(Sender As Object, E As EventArgs)
               Message.Text = "Hi " & HttpUtility.HtmlEncode(Name.Text) & ", you selected: " & Category.SelectedItem.Text
           End Sub
    
       </script>
    
       <body>
    
           <center>
    
           <form action="intro6.aspx" method="post" runat="server">
    
               <asp:adrotator AdvertisementFile="ads.xml" BorderColor="black" BorderWidth=1 runat="server"/>
    
               <h3> Name: <asp:textbox id="Name" runat="server"/>
    
               Category:  <asp:dropdownlist id="Category" runat=server>
                             <asp:listitem >psychology</asp:listitem>
                             <asp:listitem >business</asp:listitem>
                             <asp:listitem >popular_comp</asp:listitem>
                          </asp:dropdownlist>
               </h3>
    
               <asp:button text="Lookup" OnClick="SubmitBtn_Click" runat="server"/>
    
               <p>
    
               <asp:label id="Message" runat="server"/>
    
           </form>
    
           </center>
    
       </body>
    </html>
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    if you are using a normal vb.net form , then you can try something along these lines.......
    VB Code:
    1. [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Sub[/COLOR] TextBox1_KeyUp([COLOR=BLUE]ByVal[/COLOR] sender [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]Object[/COLOR], [COLOR=BLUE]ByVal[/COLOR] e [COLOR=BLUE]As[/COLOR] System.Windows.Forms.KeyEventArgs) [COLOR=BLUE]Handles[/COLOR] TextBox1.KeyUp
    2.         [COLOR=BLUE]If[/COLOR] TextBox1.Text = "test" [COLOR=BLUE]Then
    3. [/COLOR]            [COLOR=BLUE]If[/COLOR] e.KeyValue = Keys.Enter [COLOR=BLUE]Then
    4. [/COLOR]                MessageBox.Show(testing("called via enter key in the textbox"))
    5.             [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]If
    6. [/COLOR]        [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]If
    7. [/COLOR]    [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Sub
    8.  
    9. [/COLOR]    [COLOR=BLUE]Private[/COLOR] [COLOR=BLUE]Function[/COLOR] testing([COLOR=BLUE]ByVal[/COLOR] tester [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]String[/COLOR]) [COLOR=BLUE]As[/COLOR] [COLOR=BLUE]String
    10. [/COLOR]        [COLOR=BLUE]Return[/COLOR] tester
    11.     [COLOR=BLUE]End[/COLOR] [COLOR=BLUE]Function[/COLOR]
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  4. #4

    Thread Starter
    Fanatic Member carlblanchard's Avatar
    Join Date
    Sep 2003
    Location
    Bournemouth (UK)
    Posts
    539

    thanks dude

    Thanks Dude
    I am curretly building a defect management system for software and web developers,
    If you wana try it out (beta test) and keep it for free just send me a message

Posting Permissions

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



Click Here to Expand Forum to Full Width