In this post we fully teach how we can empty the entire textbox with one button key. This is a very easy task. For this we need to take two number buttons from the toolbox. A button we will use to clear all text boxes data. And other buttons we can use in our project. After adding two buttons we need to get four or five text boxes. After that we have to use below coding as per video instruction. This task can be needed in many places like any software to clear the entire data with a single button.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'it is using for your project Dim eptybox = Me.Controls.OfType(Of TextBox)().Where(Function(txt) txt.Text.Length = 0) If eptybox.Any Then MessageBox.Show(String.Format("Please fill textboxes: {0}", String.Join(",", eptybox.Select(Function(txt) txt.Name)))) Else MessageBox.Show("Here is your command") End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ' it is using for Clear all the TextBoxes on the form. For Each Control In Controls If TypeOf Control Is TextBox Then Control.Text = "" Next Control End Sub
 
Top