具有存储功能的条形码扫描仪 [英] Barcode scanner with storage capability

查看:150
本文介绍了具有存储功能的条形码扫描仪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,我有一个条形码扫描仪,它将扫描的每个条形码保存在自己的内存中.
当我选择上传条形码时,它将全部显示在一个输入中,而条形码之间没有任何中断.

我希望有人对如何开发一个程序(最好是在C#中)有一个想法,该程序可以帮助我将条形码分别加载到数据库中,以便可以分别使用每个条形码?

我尚未开始使用该程序,因此很遗憾,我还没有提供任何代码.但是,如果有机会请举一个我该如何做的例子,将不胜感激.

Hey guys I have a barcode scanner that saves each barcode it scans in its own memory.
When i chose to upload the barcodes it displays them all in a single input without any breaks in between the bar codes.

I was hoping if anybody has an idea on how I could develop a program(preferably in c#) that would help me load the barcodes individually into a database so that each barcode could be used separately?

I haven''t started with the program yet so unfortunately I do not have any code to offer yet. But please if you by any chance have an example of how I could do this it will be greatly appreciated.

推荐答案

让我们假设条形码的长度相同,则可以使用字符串类的Substring函数.否则,我看不到获得各个值的可能性...
Let''s assume the barcodes have the same length, then you can use the Substring function of the string class. Otherwise, I do not see any possibility to get the individual values...


namespace Barcode_scanner
{
    public partial class StockAdd : Form
    {
        string Location = "";
        bool end = false;
        bool fin = false;
        public List<SaveCodes> Barcodes = new List<SaveCodes>();
        public StockAdd()
        {
            InitializeComponent();
        }

        private void textBox1_KeyDown(object sender, KeyEventArgs e)
        {
            tmrClose.Enabled = false;
            tmrClose.Enabled = true;
            string s = textBox1.Text;
            if (e.KeyCode != Keys.Enter)
            {
                if (end != true && s.Length == 3)
                {
                    Location = textBox1.Text;
                    end = true;
                    textBox1.Clear();
                }
                if (end == true && e.KeyCode == Keys.S)
                {
                    s = textBox1.Text;
                    end = false;
                    s = Trim(s);
                    Barcodes.Add(new SaveCodes(Location, s));
                    Location = "";
                    textBox1.Clear();

                }
                if (fin == true)
                {
                    textBox1.Clear();
                    fin = false;
                }
            }

            else
            {
                fin = true;
                textBox1.Clear();
            }


        }

        private string Trim(string code)
        {
            string s = textBox1.Text;
            int start = s.IndexOf("//");
            int end = s.IndexOf("#");
            string result = s.Substring(start + 2, end - (start + 2));
            textBox1.Clear();
            s = "";
            return result;

        }

        private void tmrClose_Tick(object sender, EventArgs e)
        {
            Close();
        }

    }
}


这篇关于具有存储功能的条形码扫描仪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆