Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Autoselect text when tabbing into a textbox
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 10th June 12:18
jonathan allen
External User
 
Posts: 1
Default Autoselect text when tabbing into a textbox



In dialog boxes in Windows, the text in TextBox is automatically selected if
you tab into the TextBox , but not when you select the TextBox using the
mouse.

What is the preferred way to support this in VB/C# 2005?

--
Jonathan Allen
  Reply With Quote


 


2 10th June 12:18
greg burns
External User
 
Posts: 1
Default Autoselect text when tabbing into a textbox



Private Sub TextBox1_Enter(ByVal sender As Object, ByVal e As
System.EventArgs) _
Handles TextBox1.Enter

TextBox1.SelectAll()
End Sub

I believe GotFocus is the other event you should avoid.

"Note The GotFocus and LostFocus events are low-level focus events that
are tied to the WM_KILLFOCUS and WM_SETFOCUS Windows messages. Typically,
the GotFocus and LostFocus events are only used when updating UICues or when
writing custom controls. Instead the Enter and Leave events should be used
for all controls except the Form class, which uses the Activated and
Deactivate events. For more information about the GotFocus and LostFocus
events, see the WM_SETFOCUS and WM_KILLFOCUS topics in the "Keyboard Input
Reference" section of the Platform SDK Documentation in the MSDN library at
http://msdn.microsoft.com/library."

Greg
  Reply With Quote
3 10th June 12:18
jonathan allen
External User
 
Posts: 1
Default Autoselect text when tabbing into a textbox


Thanks. GotFocus was what I used in VB6, but this worked much better.

--
Jonathan Allen
  Reply With Quote


 


Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Development, Ada, Apple script, Assembler, Awk, Beos, Basic, C, C++, C#, C# .net, .net, .net frameworks, Asp .net, Clarion, Clipper, Clos, Clu, Cobol, Coldfusion, Delphi, Dylan, Eiffel, Forth, Fortran, Haskell, Hermes, Icon, Idl, Java, Java script, Jscript .net, Jcl, Linoleum, Lisp, Lotus, Limbo, Logo, Ml, Mumps, Oberon, Postscript, Pop, Pl1, Prolog, Python, Ruby, Pascal, Perl, Php, Rebol, Rexx, Sed, Sather, Scheme, Smalltalk, Tcl, Vhdl, Vrml, Visual basic, Visual basic .net, Yorick, Mysql, Omnis, Postgresql, Xbase, Access, Oracle, Adabas, Berkeley, Btrieve, Filemaker, Gupta, Db2, Informix, Ingres, Mssql server, Object, Olap, Paradox, Rdb, Revelation, Sybase, Theory, Dbase, Html, Java script, Css, Flash, Photoshop, Corel script, Xml, Tech, Beos, Gem, Hp48, Hpux, Linux, Mac, Ms-dos, Os2, Palm, Solaris, Ti99, Windows, Xenix, Aos, Chorus, Geos, Inferno, Lantastic, Lynx, Mach, Minix, Netware, Os9, Parix, Plan9, Psos, Qnx, Xinu, Sco, Unix, Aix, Aux, 386bsd, Bsdi, Freebsd, Netbsd, Openbsd, Ultrix, Amd, Intel, Aptiva, Buz, Deals, Homebuilt, Overclocking, Programming, Extra forums


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666