|
-
Jul 4th, 2007, 05:08 AM
#1
Thread Starter
Lively Member
[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.
-
Jul 4th, 2007, 05:21 AM
#2
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?
-
Jul 4th, 2007, 02:14 PM
#3
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();"
-
Jul 5th, 2007, 03:34 AM
#4
Thread Starter
Lively Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|