PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Barcode scanner return only first digit only why and How to Return Full Number-VBForums
Results 1 to 15 of 15

Thread: Barcode scanner return only first digit only why and How to Return Full Number

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Barcode scanner return only first digit only why and How to Return Full Number

    Problem

    Barcode scanner return only first digit only why and How to Return Full Number as 6221133347389

    6221133347389 return 6
    4716201020476 return 4

    Code:
    DateTime _lastKeystroke = new DateTime(0);
        List<char> _barcode = new List<char>(20);
    public PosFrm()
        {
    
    
            InitializeComponent();
            this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.PosFrm_KeyPress);
    
        }
    private void PosFrm_KeyPress(object sender, KeyPressEventArgs e)
        {
            TimeSpan elapsed = (DateTime.Now - _lastKeystroke);
            if (elapsed.TotalMilliseconds > 100)
                _barcode.Clear();
    
            // record keystroke & timestamp
            _barcode.Add(e.KeyChar);
            _lastKeystroke = DateTime.Now;
            //		e.KeyChar	52 '4'	char
    
            // process barcode
            if (e.KeyChar == 13 && _barcode.Count > 0)
            {
    
    
                string msg = new String(_barcode.ToArray());
                MessageBox.Show(msg);
                _barcode.Clear();
            }
        }
    Barcode read 2d for Items

    Barcode Device DataLogic Lite QW2100

    MODEL QY2100

    CLASS QY2120-BK

    S/N G17079019

    when reading ItemCode ' 6294004851032' by barcode scanner it return 6 only as first digit

    why it return first digit only

    i need to return full number .
    Name:  Capture.jpg
Views: 154
Size:  23.1 KB

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,788

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    If you just put the caret in a TextBox and scan, do you see the whole barcode in the TextBox?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    yes i see full in textbox

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,788

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    In that case, the issue is clearly not that the scanner is only returning the first character. The issue is clearly how you're processing the data. If you handle the KeyPress event of that TextBox, e.g.
    vb.net Code:
    1. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    2. {
    3.     Console.WriteLine(e.KeyChar);
    4. }
    do you see an event raised for each character in the barcode or only the first?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  5. #5

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    thank you for reply
    I handled the data by Form_Keypress
    why form not detect that and textbox detect that

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    thank you for reply
    I handled the data by Form_Keypress
    why form not detect that and textbox detect that

  7. #7
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,788

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    Quote Originally Posted by engbarbary View Post
    I handled the data by Form_Keypress
    I can see that.
    Quote Originally Posted by engbarbary View Post
    why form not detect that and textbox detect that
    Does the TextBox raise a KeyPress event for each character? That's what I was asking you but you didn't actually provide an explicit answer so I don't know whether you're now just assuming that it does or you've tested and found that it does. If it is indeed the case that the TextBox raises the event for each character but the form only does so for the first one then I don't know what the reason would be.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    I work in windows form in visual studio 2015
    key preview to form is true .
    keypress form break point hit
    http://www.mediafire.com/file/5148dd...form1.rar/file

  9. #9
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,788

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    How about just answering my question instead of telling me repeatedly things that I can already see for myself?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    I work in windows form in visual studio 2015
    key preview to form is true .
    keypress form break point hit
    http://www.mediafire.com/file/5148dd...form1.rar/file

  11. #11

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    form1 is above link can you help me in that

  12. #12
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    99,788

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    I can't really help any further if you refuse to provide the information I asked for. I'm done here.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  13. #13

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    when execute that
    private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
    {
    Console.WriteLine(e.KeyChar);
    }
    value reading get in textbox and show full as i want
    no number number
    if i put breakpoint on
    Console.WriteLine(e.KeyChar);
    it only hit first digit or char only that is 6

  14. #14

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    msg variable reading barcode scanner but it read wrong
    when read barcode on text file it read as following
    6294004885662 this is correct according customer say
    but msg variable read the following
    66229944000044888855666622 this is wrong
    two reading by same scanner but different
    why repeating to numbers as above
    can you please help me and i will answer to your questions direct

  15. #15

    Thread Starter
    New Member
    Join Date
    Apr 2018
    Posts
    14

    Re: Barcode scanner return only first digit only why and How to Return Full Number

    msg variable reading barcode scanner but it read wrong
    when read barcode on text file it read as following
    6294004885662 this is correct according customer say
    but msg variable read the following
    66229944000044888855666622 this is wrong
    two reading by same scanner but different
    why repeating to numbers as above
    can you please help me and i will answer to your questions direct

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
  •  



Featured


Click Here to Expand Forum to Full Width