Dim fileWriter As StreamWriter Dim sDirName As String sDirName = OutYiDooPath Dim dDir As New DirectoryInfo(sDirName) If Not dDir.Exists Then System.IO.Directory.CreateDirectory(OutYiDooPath) End If Try fileWriter = New StreamWriter(OutYiDooPathName,False,System.Text.Encoding.Default) Catch ex As Exception LblStatus.Text = Msg_Get(sProgId,"009040") MsgBox(ex.Message,sMsgTitle) Exit Sub End Try Dim title as String="aaa" fileWriter.WriteLine(title) fileWriter.Flush() fileWriter.Close()