how do I clear a field? After I made transactions?

Recommended Answers

All 3 Replies

Depends what you mean by "field". To clear a text control you set the Text property to the null string as in

TextBox1.Text ""

textbox1.Text = ""

you can do somthing like this . add a module and just call this public sub at your form when ever you want to clear your textboxes or other controls .

   Public Sub ClearAllTextBox(ByVal myControl As Object)
            Dim i As Integer
            For i = 0 To myControl.Controls.Count - 1
                If TypeOf myControl.Controls(i) Is TextBox Then
                    myControl.Controls(i).Text = ""
                ElseIf TypeOf myControl.controls(i) Is MaskedTextBox Then
                    myControl.controls(i).text = ""
                ElseIf TypeOf myControl.controls(i) Is ComboBox Then
                    myControl.controls(i).text = ""
                End If
            Next
        End Sub

just call it like this where you need.

    ClearAllTextBox(me) 
    'or if you have many group boxes or panel then then in place of me just write the name of group box or panel like this 
    ClearAllTextBox(groupbox1)

hope this will help you

Regards

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.