How to Rename a File? To Rename a file in C# is,
string path1 = @"c:\MyTest1.txt";
string path2 = @"c:\MyTest2.txt";
System.IO.File.Move(path1,path2);
To Rename a file in VB.Net is,
Dim path1 As String = "c:\MyTest1.txt"
Dim path2 As String = "c:\MyTest2.txt"
System.IO.File.Move(path1,path2)
The .NET Framework allows developers to use the same set of skills to rapidly buid great applications for the web, windows, services and more.
Clear All TextBoxes on a form
If you want to clear/Reset all Textboxes on a form, below solution will help you clear all Textboxes at a time.
You can write a simple funtion using below code,
public static void ClearAllTextBoxes(Control oControl)
{
foreach (Control ct in oControl.Controls)
{
if (ct is TextBox)
{
TextBox tb = (TextBox)ct.FindControl(ct.ID);
tb.Text = string.Empty;
}
if (ct.HasControls())
{
ClearAllTextBoxes(ct);
}
}
}
Call above Funtion using below code,
ClearAllTextBoxes(this);
You can write a simple funtion using below code,
public static void ClearAllTextBoxes(Control oControl)
{
foreach (Control ct in oControl.Controls)
{
if (ct is TextBox)
{
TextBox tb = (TextBox)ct.FindControl(ct.ID);
tb.Text = string.Empty;
}
if (ct.HasControls())
{
ClearAllTextBoxes(ct);
}
}
}
Call above Funtion using below code,
ClearAllTextBoxes(this);
Subscribe to:
Posts (Atom)