1.判断文件/目录是否存在 Try ' 先判断文件是否存在. If Not File.Exists(TextBox4.Text) Then File.CreateText(TextBox4.Text) '单纯创建文件一般不常用,正常情况下是创建文件然后进行读写操作 'System.IO.File.Create(TextBox4.Text) End If Catch ex As Exception MessageBox.Show(ex.Message) Exit Sub End Try Try '…