Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
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
 
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
 
Old May 4th, 2005, 09:19 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
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





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





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