-
Apr 26th, 2006, 02:40 AM
#1
Thread Starter
Junior Member
reset program
Hi i have created a program where the data is put into a database, after that i wish to reset and clear the program, is there a simple line of code to use? please help
-
Apr 26th, 2006, 02:48 AM
#2
Re: reset program
Clear the program of what?
-
Apr 26th, 2006, 02:52 AM
#3
Re: reset program
Clear the fields? just use..for example
txtName.Text = ""
txtDOB.Text = ""
txtAddress.Text = ""
-
Apr 26th, 2006, 02:57 AM
#4
Hyperactive Member
Re: reset program
U need to make a function to clear there fields
and then call it wherever u want...but i think there is no any single line code for doing so ... may b u could b able to do it by using
For i = 1 To form1.textbox.count - 1
form1.textbox(i).Text = ""
next i
...but for this u need to make control array of the textboxes
-
Apr 26th, 2006, 03:06 AM
#5
Re: reset program
Originally Posted by noshaba
U need to make a function to clear there fields
and then call it wherever u want...but i think there is no any single line code for doing so ... may b u could b able to do it by using
For i = 1 To form1.textbox.count - 1
form1.textbox(i).Text = ""
next i
...but for this u need to make control array of the textboxes
No need for an array when you want to loop through, use the controls collection (you can also use it to make a general clear Sub):
VB Code:
Private Sub ClearControls()
Dim ctl As Control
For Each ctl In Me.Controls
Select Case True
Case TypeOf ctl Is TextBox
ctl.Text = vbNullString
Case TypeOf ctl Is ComboBox, TypeOf ctl Is ListBox
ctl.Clear
'
'
'
End Select
Next ctl
End Sub
-
Apr 26th, 2006, 03:09 AM
#6
Re: reset program
There is a way that I do it and have discussed it before but some don't think outside the box. What you can do is design your program so that all your data is is a data class object then just set the object to nothing and re-instanciate it for all data to be cleared.
Of course you would have to do this at the beginning to code to this standard. But it will work.
-
Apr 27th, 2006, 05:17 AM
#7
Lively Member
Re: reset program
The only way I can think to do this is to unload all your past forms, open up the home form again and type
(name of home form).refresh
If, somehow, I help you, please rate the post using the scales icon in the left bar <---- .
Please Use Naming Conventions in your projects! ------\/
http://www.visibleprogress.com/vb_na...onventions.htm
Me to Brother
-Hey, look at this avater I made in about 5 seconds
-What, morrisons?
-AGHHHHHH
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|