Question Locked

vb 2005 exp ed ,,,Reset fourm ?

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi Please go easy on me as i am trying to learn visual basic 2005 express edition and finding it hard
I have created A Form which contains CheckBoxs, ListBox Lables, MaskedTextBoxs and TextBoxs (and a bit more)
The Form allows user to choose items which all give a number, The number are displayed on the Form in Lables and TexyBoxs.
I use the MaskedTextBox for the user to enter a number of their chosen number
I then have a button which caculate all the numbers.
I use the list box to display pictures and Numbered Vaules.
I have created a Class
I want to put a button on the Form so all the feilds are reset to the default nothing
I think the best way to do this would to be just reload the Form to new like if it was just opend or run again,,,,, Any help on this please
Hope you can understand what i want
Thanks for your time Doj

2 replies

by tony hopkinson

Killing your mainform though is not advisable.

Probably the easiest way, if you want to clear all the edit boxes on the form would be to use the Controls collection of form.

In C# the code would be something like

foreach(Control ctrl in this.Controls)
{
if (ctrl is TextBox)
{ ((TextBox)ctrl).Text = "";}
}

HTHs

This discussion is closed to new replies.