Results 1 to 3 of 3

Thread: Making a Function with Variable [Resolved]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Feb 2003
    Posts
    146

    Cool Making a Function with Variable [Resolved]

    Hello again

    I've trying to make a function that I can call that will make the existing text in a textbox be highlighted whenever the textbox gets focus... rather than copying the .selstart code over and over for every box's GotFocus.

    I've never made a function with a variable like this before, so of course I'm having problems

    I've got this in the module:

    Code:
    Public Function HighLightIt(TextBoxName As Object)
        With TextBoxName
            .SelStart = 0
            .SelLength = Len(.Text)
        End With
    End Function
    And am using it in each textbox's GotFocus like:

    HighLightIt(txtFirstName)

    I keep getting "Compile Error: Type Mismatch" when trying to run it. I've tried TextBoxName as Control, Object and Textbox.

    I'm sure someone sees what I'm doing wrong... please tell me :P

    Thanks
    Last edited by pinkclown; Oct 22nd, 2003 at 02:53 PM.

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Feb 2003
    Posts
    146
    Ackkk So easy... Oh well I learned from it.

    Thanks Martin!

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