Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. textbox loosing focus

textbox loosing focus

Scheduled Pinned Locked Moved Visual Basic
helpcssquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    txtFind is a textbox that is used for search purposes (ie if a value is entered and the text box looses focus, a grid appears displaying a range of results). However, if no value is entered and it looses focus, i want the focus to be set on another text box: If txtFind.Text = "" Then txtCustomerCode.SetFocus Exit Sub End If However, this generates the error: "Invalid procedure call or argument", is there anything i can do to alleviate this? thanks in advance for any help!let me know if any additional detail is required.

    J M 2 Replies Last reply
    0
    • A Anonymous

      txtFind is a textbox that is used for search purposes (ie if a value is entered and the text box looses focus, a grid appears displaying a range of results). However, if no value is entered and it looses focus, i want the focus to be set on another text box: If txtFind.Text = "" Then txtCustomerCode.SetFocus Exit Sub End If However, this generates the error: "Invalid procedure call or argument", is there anything i can do to alleviate this? thanks in advance for any help!let me know if any additional detail is required.

      J Offline
      J Offline
      Jerome Conus
      wrote on last edited by
      #2

      Hi ! I get this same error when the control to which I want to set the focus is not visible. Jerome

      1 Reply Last reply
      0
      • A Anonymous

        txtFind is a textbox that is used for search purposes (ie if a value is entered and the text box looses focus, a grid appears displaying a range of results). However, if no value is entered and it looses focus, i want the focus to be set on another text box: If txtFind.Text = "" Then txtCustomerCode.SetFocus Exit Sub End If However, this generates the error: "Invalid procedure call or argument", is there anything i can do to alleviate this? thanks in advance for any help!let me know if any additional detail is required.

        M Offline
        M Offline
        mikasa
        wrote on last edited by
        #3

        First of all, make sure you have another Control that can get Focus (i.e. It must be Enabled and if there is an "AllowFocus" property, set it to true). Then in the Validate Event: If (txtFind.Text.Length = 0) Then txtNext.Focus():Exit Sub 'Otherwise, populate Grid Here

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups