Thursday 11 July 2013

only numeric in textbox in c#

private void txt_producerName_KeyPress(object sender, KeyPressEventArgs e)
        {
           try
            {
                if (Convert.ToInt16(e.KeyChar) == 8)
                    backspaceflag = true;
                else
                    backspaceflag = false;
                if (char.IsNumber(e.KeyChar) || Convert.ToInt16(e.KeyChar) == 8)
                {
                    e.Handled = false;
                }
                else
                {
                    e.Handled = true;
                }

            }
            catch (Exception ex)
            {
            }
        }

No comments:

Post a Comment

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...