2010-10-28 28 views
0

J'ai compilé la petite application suivante seulement Je veux que toutes les textpox soient effacées quand les onglets sont passés par l'utilisateur comment cela peut-il être réalisé?Aidez-moi à effacer toutes mes zones de texte?

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

C'est * PAS * VBA. Veuillez marquer correctement les questions. – Fionnuala

Répondre

1
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 
+0

Appelez-moi bête mais cela va avec la section suivante de code? Privé Sub TabPage1_Click (expéditeur ByVal comme System.Object, ByVal e comme System.EventArgs) Handles TabPage1.Click End Sub –