Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 10-01-2008, 09:38 AM   #1 (permalink)
Digital_Jedi's Avatar
 
True Techie

Join Date: Sep 2008

Location: Amarillo, Texas

Posts: 125

Digital_Jedi is on a distinguished road

Question C# clear button

I have never used C# before but we have to use it for my GUI class and I cannot figure out how to get a button to clear a form. I just need to reset the form back to normal when you first run the debug.
Digital_Jedi is offline  
Old 10-01-2008, 12:16 PM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: C# clear button

You need to be more specific in your questions, since "clear a form" is ambiguous. However, I'll try to answer your question making the following assumptions:
- You're using Windows Forms and not WPF
- "Clear a form" means clear text from a text box or text boxes

In the button click event handler, you need to call the "Clear" method on each text box. You can find the name of each text box by right clicking on it and selecting "Properties" from the context menu. A property grid will open up in Visual Studio if it is not already opened. You can find the variable name in the grid.

So, for each text box, you'll need to do something like the following:
Code:
void Button_Click(object sender, EventArgs e)
{
    textBox1.Clear();
    ....
}

jaeusm is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Are there power button mods for PC-A70? RoRol Overclocking, Case Mod, Tweaking PC Performance 6 05-27-2008 11:22 AM
Dell Ultrasharp 2407WFP monitor button not responding influx Hardware Troubleshooting 4 04-28-2008 11:22 PM
Black Viper's Top tweaks for a faster PC xXxexpertxXx Overclocking, Case Mod, Tweaking PC Performance 0 02-21-2008 10:04 PM