아주 간단하게 들리지만 검색했기 때문에 방금 만든 파일을 열 수있는 방법을 찾지 못하는 것 같습니다. 앱. 파일이 생성되고 나면 파일을 열려고합니다.사용자가 vb.net에서 읽거나 쓸 파일을 엽니 다.
은 내가 Dim path As String = TextBox1.Text
및 사용자 이름 일단이 내가 "완료"라는 MSGBOX이있는의 SaveFileDialog에서 확인을 클릭하고 확인을 쳤을 때 나는이
FileOpen(FreeFile, path, OpenMode.Input)
을 시도했지만 아무 일도 일어나지 않습니다. 난 그냥 로그를 열고 그것을 편집하거나 다시 또는 아무것도 저장할 수 있도록 사용자에게 보여주고 싶습니다.
위의 코드가있는 곳입니다. http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.filesystem.fileopen.aspx
누구나 파일을 열어 런타임 중에 처리하려고하기 때문에 검색하기가 어렵습니다. 나는 단지 Show
에 의해 Launching
에 의해 파일을하려고 누군가가 그것을 두 번 클릭 좋아해. 전체 내보내기 단추가 Sub를 클릭합니다. 기본적으로 목록 상자 항목을 파일에 씁니다.
Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click
Dim sfd As New SaveFileDialog
Dim path As String = TextBox1.Text
Dim arypath() As String = Split(TextBox1.Text, "\")
Dim pathDate As String
Dim foldername As String
foldername = arypath(arypath.Length - 1)
pathDate = Now.ToString("yyyy-MM-dd") & "_" & Now.ToString("hh;mm")
sfd.FileName = "FileScannerResults " & Chr(39) & foldername & Chr(39) & " " & pathDate
sfd.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
sfd.Filter = "Text files (*.txt)|*.txt|CSV Files (*.csv)|*.csv"
sfd.ShowDialog()
path = sfd.FileName
Using SW As New IO.StreamWriter(path)
If CkbxFolder.Checked = True Then
SW.WriteLine("Folders")
For Each itm As String In ListBox1.Items
SW.WriteLine(itm)
Next
End If
If CkbxFiles.Checked = True Then
SW.WriteLine("Files")
For Each itm As String In ListBox2.Items
SW.WriteLine(itm)
Next
End If
End Using
MsgBox("Done...")
FileOpen(FreeFile, path, OpenMode.Input) 'Why can't I open a file for you...
End Sub
FileOpen은 아무 것도 보여주지 않고 파일을 열면 내용을 읽고 여러 줄 텍스트 상자에 표시합니다. – Steve