English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

this is going to be a bonus question in my gr 10 visual basic programming test!! really need this! doing really low in the course.

2006-12-19 09:15:55 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

To delete files in VB you can use the KILL command.

Kill "MyFile.Txt"
Kill "*.Txt"
Kill "C:\MyData\MyFile.Txt"

2006-12-19 09:58:53 · answer #1 · answered by Anonymous · 0 0

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myDlg As New OpenFileDialog
Dim myFile As New FileIO.FileSystem
Dim ans As DialogResult


On Error GoTo err_handler
With myDlg
.InitialDirectory = "C:/"
.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.* "
If .ShowDialog = Windows.Forms.DialogResult.OK Then

ans = MessageBox.Show("Confirm Deletion of " & vbCrLf & .FileName, _
"Delete File:", _
MessageBoxButtons.OKCancel)

If ans = Windows.Forms.DialogResult.OK Then
myFile.DeleteFile(.FileName)
End If
End If
End With

Exit Sub
err_handler:

End Sub

2006-12-19 17:52:19 · answer #2 · answered by MarkG 7 · 1 0

u can use "kill" command and foldor is spelled folder =)

2006-12-19 17:44:16 · answer #3 · answered by Anonymous · 0 0

fedest.com, questions and answers