Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

read barcode with barcode scanner c# winform serial port number

public class ScannerTextBox : TextBox
{
    public bool BarcodeOnly { get; set; }

    Timer timer;

    private void InitializeComponent()
    {
        this.SuspendLayout();

        this.ResumeLayout(false);
    }

    void timer_Tick(object sender, EventArgs e)
    {
        if (BarcodeOnly == true)
        {
            Text = "";
        }

        timer.Enabled = false;
    }

    protected override void OnKeyPress(KeyPressEventArgs e)
    {
        base.OnKeyPress(e);

        if (BarcodeOnly == true)
        {
            if (timer == null)
            {
                timer = new Timer();
                timer.Interval = 200;
                timer.Tick += new EventHandler(timer_Tick);
                timer.Enabled = false;
            }
            timer.Enabled = true;
        }

        if (e.KeyChar == '
')
        {
            if (BarcodeOnly == true && timer != null)
            {
                timer.Enabled = false;
            }
        }
    }
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# gridview summary item displayformat 
Csharp :: nest elasticsearch date reange c# .net 
Csharp :: antlr c# errors 
Csharp :: C# Implicitly typed variable 
Csharp :: c# find the smallest string in an array of strings 
Csharp :: snakes and ladder single player c# 
Csharp :: c# fileinfo filename without extension 
Csharp :: xamarin c# switch on hotspot Programmatically 
Csharp :: How to keep line breaks in SQL Server using ASP.NET and C#? 
Csharp :: anidate bucle in c# 
Csharp :: telerik mvc grid round sum result 
Csharp :: c# list to string replace last comma with and 
Csharp :: Handling aggregation responses with NEST c# 
Csharp :: stack in c# 
Csharp :: file.deletealltext 
Csharp :: cmd command see which groups a user is in 
Csharp :: single number c# 
Csharp :: sqlsinifi.baglanti.open() 
Csharp :: Unity SceneLoad by Name in Inspector 
Csharp :: umbraco cannot start. a connection string is configured but umbraco cannot connect to the database. 
Csharp :: unity random.insideunitcircle 
Csharp :: c# unhandled exception in thread” 
Csharp :: what is difference between int.Parse and toint32 in c# 
Csharp :: make wpf run in fullscreen but above windows taskbar 
Csharp :: dapper query list of parameters 
Csharp :: Unity make a homing object 
Csharp :: advance C# tricks and hits 
Csharp :: Remove tabpage by key 
Csharp :: Valid date check with DateTime.TryParse method 
Csharp :: c# remove 0 from string 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =