Can anyone please send code for search form which contains clearing controls,validating and contains same criteria when you click search again button.

Dim txtb() As TextBox = {txtA, txtB, txtC}
           For Each ctrl As TextBox In txtb
                ctrl.Text = "" 
           Next

or

For Each ctrl As Object In Me.Controls
                If ctrl.GetType.Name = "TextBox" Then
                    ' do something
                End If
          Next

can you please send sample program with some search criteria,including clearing controls,validating and search criteria remains same when you click revise again in search form

can you please send sample program with some search criteria,including clearing controls,validating and search criteria remains same when you click revise again in search form

Tratak was given u a codes, use it. however you didn't show how far u done with this? where is your effort? have u read a rules??
We only give homework help to those who show effort

sub clear()

me.combobox1.clear()
me.combobox2.clear()
me.textbox1.clear()
end sub

Private Sub nameTextBox1_Validated(sender As Object, e As System.EventArgs) Handles nameTextBox1.Validated
If IsNameValid() Then
' Clear the error, if any, in the error provider.
nameErrorProvider.SetError(Me.nameTextBox1, "")
Else
' Set the error if the name is not valid.
nameErrorProvider.SetError(Me.nameTextBox1, "Name is required.")
End If
End Sub

this following code to clear controls, you can add what control you want to clear :

Public Sub ClearControl(ByVal root As Control)
        For Each ctrl As Control In root.Controls
            ClearControl(ctrl)
            If TypeOf ctrl Is TextBox Then
                CType(ctrl, TextBox).Text = String.Empty
            ElseIf TypeOf ctrl Is ComboBox Then
                CType(ctrl, ComboBox).Text = String.Empty
            End If
        Next ctrl
    End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    ClearControl(Me)
End Sub
This article has been dead for over six months. Start a new discussion instead.