| | |
how to reset the form
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jun 2009
Posts: 269
Reputation:
Solved Threads: 54
no. me.refresh will just update
its actually depends on what exactlly you wish to reset like textboxes, checkboxes and so on.
you could do an function like:
end sub
something like that
its actually depends on what exactlly you wish to reset like textboxes, checkboxes and so on.
you could do an function like:
vb Syntax (Toggle Plain Text)
private sub ClearCtrl for each ctrl as control in Form1 try if typeof(ctrl) is checkbox then ctrl.checked=false if typeof(ctrl) is textbox then ctrl.clear catch as exception 'catch the containers here end try next
something like that
Last edited by GeekByChoiCe; Sep 6th, 2009 at 2:27 am.
I don't get a word "reset". Do you want to reset the state of controls or just clear the text or setting up selectedindex with 0?
vb.net Syntax (Toggle Plain Text)
For Each c As Control In Me.Controls If TypeOf c Is TextBox Then CType(c, TextBox).Text = String.Empty End If Next
•
•
Join Date: Jun 2009
Posts: 269
Reputation:
Solved Threads: 54
cant edit my post anymore. but since adatapost told me its not working i did a test and its working
works as it is and only if you dont have the controls inside containers such as panels, groupboxes then you need to recurse these aswell.
vb Syntax (Toggle Plain Text)
For Each ctrl As Control In Me.Controls Try If TypeOf (ctrl) Is CheckBox Then DirectCast(ctrl, CheckBox).Checked = False If TypeOf (ctrl) Is TextBox Then DirectCast(ctrl, TextBox).Clear() Catch ex As Exception 'catch the containers here End Try Next
works as it is and only if you dont have the controls inside containers such as panels, groupboxes then you need to recurse these aswell.
![]() |
Other Threads in the VB.NET Forum
- Previous Thread: How to pass a file name from another class
- Next Thread: Receive Email in vb.net 2005 Part 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2005 2008 access account application array arrays basic beginner browser button buttons center checkbox client code convert cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic eclipse excel fade filter forms ftp generatetags gridview html images inline input insert intel internet lib listview mobile monitor net objects open panel passingparameters pdf picturebox port position print printing problem read remove save searchvb.net select serial settings shutdown soap sorting sqlserver survey table temperature textbox timer timespan transparency trim update user validation vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web webbrowser winforms wpf wrapingcode year






