Results 1 to 4 of 4

Thread: [RESOLVED] Vb6 to asp.net (vb)

Hybrid View

  1. #1

    Thread Starter
    Lively Member achor's Avatar
    Join Date
    May 2006
    Location
    Porto
    Posts
    123

    Resolved [RESOLVED] Vb6 to asp.net (vb)

    Hello All,

    I think this is a simple question, but I've already searched and I can´t find nothing.

    Code:
    Private Sub txtSearch_GotFocus()
     
        If txtSearch <> "" Then
            SendKeys "{END}"
        End If
    
    End Sub
    Code:
    Private Sub txtSearch_Key_Press(KeyAscii As Integer)
       
            If KeyAscii = 13 Then 
                  cmdSearch_Click
            end if
            
    End Sub
    I want to do something like this in my asp.net page Bu I just can't do it.

    When my txtSearch got focus, select it's Text.
    And when I press 'Enter', it clicks the cmdSearch Button.

    Help please.
    Last edited by achor; Jul 4th, 2007 at 05:17 AM.

  2. #2
    Frenzied Member Fishcake's Avatar
    Join Date
    Feb 2001
    Location
    Derby, UK
    Posts
    1,092

    Re: Vb6 to asp.net (vb)

    You need to think about what you are trying to achieve here.

    I'm presuming your vb6 code was for a windows application? But when you're working with a web application vb.net code runs on the server and can't access client side events. So the functionality you require will require clientside scripting such as Javascript.

    Make sense?

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: Vb6 to asp.net (vb)

    ASP.NET has a DefaultButton property. That will take care of the 'enter' for you.

    As for selecting all of the text, you need a bit of javascript.

    In the textbox's onFocus event,

    Code:
    onfocus="document.Form1.txt1.select();"

  4. #4

    Thread Starter
    Lively Member achor's Avatar
    Join Date
    May 2006
    Location
    Porto
    Posts
    123

    Re: Vb6 to asp.net (vb)

    Hello fishcake and mendhak,

    First ok, fishcake it makes sense. I'll have to search for some more info about java script.

    Second mendhak, thank you. I'll try the javascript.

    Thank you both.

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