tags:

views:

25

answers:

1

Hi

I compiled the following little application only I want all the textpoxes cleard when the tabs areswitched by the user how can this be achieved?

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox2.Text) + "," + "        " + "*" + (TextBox1.Text))
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox3.Text) + "," + "     " + "START " + (TextBox4.Text) + ", 1,,")
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    Dim FILE_NAME As String = "C:\test.pgp"

    If System.IO.File.Exists(FILE_NAME) = True Then
        Dim objWriter As New System.IO.StreamWriter(FILE_NAME, True)
        objWriter.WriteLine((TextBox5.Text) + "," + "     " + "START " + (TextBox6.Text) + ", 1,,")
        objWriter.Close()
        MsgBox("The acad.pgp file was successfully appended…")
    Else
        MsgBox("File missing reinstall or contact vendor…")
    End If

End Class

+1  A: 
Public Sub ClearTextBoxes(frmClearMe As Form)

 Dim txt As Control

  For Each txt In frmClearMe

  If TypeOf txt Is TextBox Then txt.Text = ""

  Next

End Sub
Orbit
Call me dumb but this goes in with following section of code?Private Sub TabPage1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TabPage1.Click End Sub
Some-guy