»Dotnet Ads
»Message Boards
Message Boards
Dotnet Books
»Member Details
Register
Login
LogOut
Submit Code
Submit Jobs
Submit Projects
»Competition
Community
Winners
Prizes
Write For Us
Members
»Other Resources
Links
Dotnet Resources
|
A simple function to clear values in a Form controlsI created this function so that it can be used to clear values in form
public static void ClearForm(Form frm)
{
foreach (Control myControl in frm.Controls)
{
foreach (Control c in myControl.Controls)
{
if (c != null)
{ ///clear text fields
if (c.GetType().ToString().ToLower().IndexOf("textbox") > 0)
{
((TextBox)c).Text = "";
}
///clear check boxes
if (c.GetType().ToString().ToLower().IndexOf("checkbox") > 0)
{
((CheckBox)c).Checked = false;
}
}
}
}
}
|
|