Thursday 17 May 2018

Replace Zero with Blank or Dash in SSRS

Here is the solution to replace zero with the Blank(' ') or Dash(-)

select textbox and check the properties on right side pan as shown in image.

for blank use below format
''0.00;(''0.00);''

for dash use below format
''0.00;(''0.00);'-'

Saturday 12 May 2018

How to add the value of Barcode scanner in Textbox C#

Hi Guys,


Before doing the C# code we have to design out mobile windows application as per given below.

Above screen has one Text box and one label to display our output return by the scanner machine.

C# Code: 

public partial class MainPage : Form
    {
        public System.Windows.Forms.Timer tmrDelay;
        public MainPage()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (textBox1.Text.Trim().Length == 1)
                {
                    tmrDelay.Enabled = true;
                    tmrDelay.Tick += new EventHandler(tmrDelay_Tick);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            } 
           
        }

        void tmrDelay_Tick(object sender, EventArgs e)
        {
            try
            {
                tmrDelay.Enabled = false;
                string strCurrentString = textBox1.Text.Trim().ToString();
                if (strCurrentString != "")
                {
                    //Do something with the barcode entered 
                    lblOutput.Text="Output : "+strCurrentString;
                    textBox1.Text = "";
                }
                textBox1.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
       
        private void MainPage_Load(object sender, EventArgs e)
        {
            tmrDelay = new System.Windows.Forms.Timer(); 
            tmrDelay.Interval = 1000; 
            tmrDelay.Enabled = false;
        }

    }

After adding above code we will get the output as given below.

Thanks for reading :)