Results 1 to 6 of 6

Thread: textbox_TextChanged event

  1. #1

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    textbox_TextChanged event

    I am currently using the TextChanged event of a textbox which fires after a user scans a barcode into it.

    The problem is that if the user scans 10 characters into it it fires 10 times.

    There are times when I want after lets say 4 characters to clear the entry to present the user with a blank textbox. If after the the 4th fireing of the event I use textbox.text = "" it will only remove the first 4 characters and leave the remaining 6.

    Any Ideas ?
    Man am I stressed today :-(

    Parksie

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: textbox_TextChanged event

    a little confused... but you are saying each time they scan a barcode, it is only 1 character going into the textbox?

  3. #3

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Re: textbox_TextChanged event

    If I scan in a 10 character barcode the textchanged event fires ten times.

    "1"
    "12"
    "123"
    "1234"
    .
    .
    "1234567890"

    Parksie

  4. #4
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: textbox_TextChanged event

    And you want to clear the textbox in the fourth fire? Do you mean the barcode is populating the textbox incrementally? As in, no matter what you delete in the 9th fire, the 10th time, the textbox will have 10 characters?

    Then perhaps you should be doing a check for the length of the text itself, or even better find another event such as validate to use.

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: textbox_TextChanged event

    yeah i was just about to say you probably don't want to use the textchange event... its more for validating char by char what is being put in, where I would think when scanning a barcode, you just want to look at things when the scan has been completed.

  6. #6

    Thread Starter
    Fanatic Member venerable bede's Avatar
    Join Date
    Sep 2002
    Location
    The mystic land of Geordies
    Posts
    1,018

    Re: textbox_TextChanged event

    Thanks for that.

    I'll look into the validate event.

    Parksie

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