For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic Syntax > March 2006 > SetFocus on text field?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author SetFocus on text field?
Astorni

2006-03-18, 4:14 pm

After many years of using different systems, I am trying Visual Basic Express 2005.
I tried to design a form with an input text field (more precisely, Systems.Windows.Form.TextBox) that I called MyAnswer.
If something wrong is entered, I wanted to give focus to this field, so I wrote:

MyAnswer.SetFocus()

This is the error that I receive:

Error 1: 'SetFocus' is not a member of 'System.Windows.Forms.TextBox'.

How do I set the focus on my input text box?

TIA
Amedeo
Jeff Johnson [MVP: VB]

2006-03-18, 9:58 pm


"Astorni" <Astorni.24w6cn@mail.codecomments.com> wrote in message
news:Astorni.24w6cn@mail.codecomments.com...

> After many years of using different systems, I am trying Visual Basic
> Express 2005.


This is a VB "classic" newsgroup. Questions about VB.NET (including VB 2005,
which has dropped .NET from its name) are off-topic here.

Please ask .NET questions in newsgroups with "dotnet" in their names. The
*.vb.* groups are for VB6 and earlier. If you don't see the *.dotnet.*
groups on your news server, connect directly to the Microsoft server:
msnews.microsoft.com.


Nits

2006-03-20, 9:57 pm

Hi,

anyway

in VB .Net and all subsequent versions the method name of SetFocus is
changed
to Focus only.

so u can say

MyAnswer.Focus()

Nits.

Bob Butler

2006-03-20, 9:57 pm

"Nits" <nitinvraj@gmail.com> wrote in message
news:1142909078.071127.37010@u72g2000cwu.googlegroups.com
> in VB .Net and all subsequent versions


Well, at least until somebody else gets a bug up their butt and decides to
change it again that is...

--
Reply to the group so all can participate
VB.Net: "Fool me once..."

Ken Halter

2006-03-21, 3:58 am

"Nits" <nitinvraj@gmail.com> wrote in message
news:1142909078.071127.37010@u72g2000cwu.googlegroups.com...
> Hi,
>
> anyway
>
> in VB .Net and all subsequent versions the method name of SetFocus is
> changed
> to Focus only.
>
> so u can say
>
> MyAnswer.Focus()
>
> Nits.


Silly change. All that does is break existing code. Besides... on the
"readability scale", I'd say the "SetFocus" keyword is better at explaining
what it does than just "Focus". I guess, in some version down the road,
it'll just be "F" <g> Which'll please all of you "text messaging" types, eh?
<g> I can c u 2 (gimme a break <g> )

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com