2007-07-13

Clear all text on one method

There are two parameters that send to this method.

1. Parent control such as panel , group box etc.
2. Control that you want to ignore.

Sample Code


Private Sub ClearData(ByVal parentCtr As Control, _

Optional ByVal ignoreControl As Control = Nothing)
Dim
ctr As Control

For Each ctr In parentCtr.Controls

If Not (ctr Is ignoreControl) Then

If TypeOf ctr Is TextBox Then

ctr.Text = ""

ElseIf TypeOf ctr Is ComboBox Then

DirectCast(ctr, ComboBox).SelectedIndex = -1

ElseIf TypeOf ctr Is ListBox Then

CType(ctr, ListBox).Items.Clear()

End If

End If

ClearData(ctr, ignoreControl)

Next

End Sub



2 comments:

Anonymous said...

Hi
http://www.katrinaimages.org/ - generic diazepam

One should also pay attention towards the dose which one needs to take.
[url=http://www.katrinaimages.org/]generic valium[/url]
Generally, it is different from individual to individual.
valium cost
Generally, it is different from individual to individual.

Anonymous said...

Hello. And Bye.