Horje
C# clear form Code Example
c# clear a textbox
// Method 1: Use clear method
Textbox.clear();
// Method 2: Set text to string.Empty
Textbox.Text = string. Empty;
// Method 3: Set text to blank
Textbox.Text = "";
c# console clear
using System;
using System.Collections.Generic;

class Program {
   static void Main() {
      ConsoleColor foreColor = Console.ForegroundColor;
      ConsoleColor backColor = Console.BackgroundColor;
      Console.WriteLine("Clearing the screen!");
      Console.Clear();
      ConsoleColor newForeColor = ConsoleColor.Blue;
      ConsoleColor newBackColor = ConsoleColor.Yellow;
   }
}
C# clear form
public class Utilities
    {
        public static void ResetAllControls(Control form)
        {
            foreach (Control control in form.Controls)
            {
                if (control is TextBox)
                {
                    TextBox textBox = (TextBox)control;
                    textBox.Text = null;
                }

                if (control is ComboBox)
                {
                    ComboBox comboBox = (ComboBox)control;
                    if (comboBox.Items.Count > 0)
                        comboBox.SelectedIndex = 0;
                }

                if (control is CheckBox)
                {
                    CheckBox checkBox = (CheckBox)control;
                    checkBox.Checked = false;
                }

                if (control is ListBox)
                {
                    ListBox listBox = (ListBox)control;
                    listBox.ClearSelected();
                }
            }
        }
  		
  		private void button1_Click(object sender, EventArgs e)
		{
     		Utilities.ResetAllControls(this);
		}
    }




Csharp

Related
wpf rotate component Code Example wpf rotate component Code Example
how to change color of part from the text in textblock wpf Code Example how to change color of part from the text in textblock wpf Code Example
replace multiple characters in string c# Code Example replace multiple characters in string c# Code Example
project mongodb c# Code Example project mongodb c# Code Example
Static Keyword Code Example Static Keyword Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10