prav_roy
Well-known member
hi,
i want to clear all the textboxes placed in a form using fallowing code, all text boxes are placed on PANEL control.. i am using following code.. it is not working can anybody tel me where i am going wrong
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
ClearTextBoxes(Me)
End Sub
Public Sub ClearTextBoxes(ByVal frm As Form)
Dim obj As New Control()
Dim obj1 As New Control()
Dim obj3 As New Control()
For Each obj In Me.Controls
If TypeOf obj Is TextBox Then
obj.Text = ""
End If
If TypeOf obj Is Panel Then
For Each obj1 In obj.Controls
If TypeOf obj1 Is TextBox Then
obj3.Text = ""
End If
Next
End If
Next
End Sub
i want to clear all the textboxes placed in a form using fallowing code, all text boxes are placed on PANEL control.. i am using following code.. it is not working can anybody tel me where i am going wrong
Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click
ClearTextBoxes(Me)
End Sub
Public Sub ClearTextBoxes(ByVal frm As Form)
Dim obj As New Control()
Dim obj1 As New Control()
Dim obj3 As New Control()
For Each obj In Me.Controls
If TypeOf obj Is TextBox Then
obj.Text = ""
End If
If TypeOf obj Is Panel Then
For Each obj1 In obj.Controls
If TypeOf obj1 Is TextBox Then
obj3.Text = ""
End If
Next
End If
Next
End Sub