Showing posts with label Windows forms. Show all posts
Showing posts with label Windows forms. Show all posts

How to find space in between word using c# .net

In windows Application we want to check empty space paste the below coding in your .cs page...


for example


Name Field: "  Mano   kumar"

Here 2 spaces . so we want to find put below lines.....




if(TextBox1.Text.Contains(""))
{

     MessageBox.Show("Please Enter Name without Space");
}




read more...

How to validate textbox to accept only numeric value in C#.net


 Below Coding for accept only Numbers.....


      if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8)
            {
                e.Handled = true; // Remove the character
                MessageBox.Show("Please Enter No only...");
            }
read more...

How to clear selected item in combobox in c#


For Windows Application We Want to Paste Below Lines


combobox1.selectedIndex = -1;
read more...

How to validate textbox to accept only characters in windows form


 Below Coding TextBox Accept only Characters....


  if ((e.KeyChar >= 65 && e.KeyChar <= 90) || (e.KeyChar >= 97 && e.KeyChar <= 122) ||               (e.KeyChar  == 32) || (e.KeyChar == 8))  //keychar 8 is for backspace
            {
                e.Handled = false;

            }
            else
            {
                e.Handled = true;
                MessageBox.Show("Please Enter Character Only...." );
             }
read more...