dcsimg
Results 1 to 3 of 3

Thread: [RESOLVED] Elegant way to check if a Textbox just contains spaces.

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    410

    Resolved [RESOLVED] Elegant way to check if a Textbox just contains spaces.

    I am checking our edit textboxes for "" but something happened today that I can only put down to the user having something sitting on the spacebar.

    I can loop through the supposed contents of the box but wondered if there a more elegant solution.

    many thanks.

    I realise now I was reading the Codebank. Can a Mod move this please.
    Last edited by Steve Grant; Aug 22nd, 2018 at 03:44 PM. Reason: Posted in Codebank by mistake,

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    4,583

    Re: Elegant way to check if a Textbox just contains spaces.

    I saw several others here, so assumed one of them would have answered, but perhaps they were thinking the same thing.
    The first thing that comes to mind would be to use Trim$
    If Len (Trim$(Textbox1.Text)) = 0 Then 'the textbox has only spaces or is empty.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2007
    Location
    Essex, UK.
    Posts
    410

    Re: [RESOLVED] Elegant way to check if a Textbox just contains spaces.

    Many thanks Passel, Trim$ had not come to mind.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width