Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What happened to setfocus? 1

Status
Not open for further replies.

wendas

MIS
Joined
Apr 20, 2001
Messages
92
Location
US
My co-worker and I are new to VB.net from VB6.. We have read & taken on-line courses all telling us the differences. I searched before posting to see if anyone else was mystified, no one is.. But we can't find the ability to do a command.setfocus anymore.. We used this all the time! What's the workaround?

Thanks,
Wenda
 
Controls now have a .Focus property. So you can determine if a control has Focus and you can set any control to have focus:
Code:
if txtField.Focus then btnOK.Focus = True

-Rick


VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
The SetFocus method has been replaced with the Select method. For example, to set focus to a command button:

Button1.Select()


I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top