Results 1 to 5 of 5

Thread: [RESOLVED] Me!Text1 = Me.Text1 ???

  1. #1

    Thread Starter
    Addicted Member reacen's Avatar
    Join Date
    Jul 2009
    Location
    c:\windows\system32\gdi32.dll
    Posts
    243

    Resolved [RESOLVED] Me!Text1 = Me.Text1 ???

    hi, I found for the 1st time, a source-code where a guy uses "!" instead of "." to access the controls of a Form !

    eg:

    Code:
    Msgbox Form1.Text1.Text
    is the same as :

    Code:
    Msgbox Form1!Text1.text
    (After making my tests, I noted that: use the "!" will point only to the controls, and not work with properties! (Me!Caption will not work))

    But, i need more informations about that, is ther something else i dont know ?
    DoEvents

  2. #2
    Just a Member! seenu_1st's Avatar
    Join Date
    Aug 2007
    Location
    India
    Posts
    2,170

    Re: Me!Text1 = Me.Text1 ???

    yes u r right its working only for controls, thanks for ur info...
    Seenu

    If this post is useful, pls don't forget to Rate this post.
    Pls mark thread as resolved once ur problem solved.
    ADO Tutorial Variable types SP6 for VB6, MsFlexGrid fast fill, Sorting Algorithms


  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Me!Text1 = Me.Text1 ???

    Office VBA also uses this optional notation but for objects

    Ex...
    Access:
    Form1!TextBox1.Text
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4
    PowerPoster dilettante's Avatar
    Join Date
    Feb 2006
    Posts
    24,487

    Re: Me!Text1 = Me.Text1 ???

    The default property of a Form is a hidden property named [_Default] which normally holds a reference to the Form's Controls collection.

    The "bang" (!) syntax is usable for access to a collection object's Item property. Using various levels of default properties, these all produce the same result when used in Form1:
    Code:
        MsgBox Form1.[_Default].Item("Command1").Name
        MsgBox Form1!Command1.Name
        MsgBox Form1.Controls("Command1").Name
        MsgBox Form1.Controls.Item("Command1").Name
        MsgBox Form1.Controls!Command1.Name
        MsgBox Command1.Name

  5. #5

    Thread Starter
    Addicted Member reacen's Avatar
    Join Date
    Jul 2009
    Location
    c:\windows\system32\gdi32.dll
    Posts
    243

    Re: Me!Text1 = Me.Text1 ???

    Woow thanks dilettante
    DoEvents

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width