Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 4th, 2005, 09:11 AM
vbmazza
Guest
 
Posts: n/a
Default Setting Focus on a Text Box in a Web Form

Hi,

I have created a web form with VB .Net in Visual Studio.Net.

I have a textbox on the form, which allows an entry only when a button is pressed. I need to set the focus to that textbox so the cursor blinks in the textbox when the button is pressed, so as to prompt the user to fill in the textbox.

In VB6 I used SetFocus in a windows form for a textbox, is their an equivelant to this in VB .Net, so far I cannot find it!

Thanks


VBMazza
Reply With Quote
  #2 (permalink)  
Old May 4th, 2005, 09:19 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

No, there is equivalent because it's a client-side operation. You need to send some JS to the client to do this when the page loads:

document.getElementById('txtMyTextBox').focus();

This will work when your textbox lives on the web form itself. (If the textbox is in a user control, it's a bit more tricky.

-Peter
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting Text Box Focus sathish_reddy ASP.NET 1.0 and 1.1 Professional 1 November 22nd, 2006 02:26 AM
How to determine which text box has focus JAnthony Access VBA 2 April 19th, 2006 02:29 PM
Setting Focus on a Sub Form Brendan Bartley Access 1 August 8th, 2005 02:41 AM
How to focus the insertion point in a text box larry Javascript How-To 3 April 2nd, 2004 07:12 PM
Setting focus to a web control textbox? hilda ASP.NET 1.0 and 1.1 Basics 2 November 1st, 2003 11:14 AM



All times are GMT -4. The time now is 08:50 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.