在这里我打开一个文件,但我不打开它然后被移动到另一个目录中的文件夹是程序是继承人到目前为止的代码
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
OpenFileDialog1.Title = "Please Select a File"
OpenFileDialog1.InitialDirectory = "C:temp"
OpenFileDialog1.ShowDialog()
End Sub
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
Dim strm As System.IO.Stream
strm = OpenFileDialog1.OpenFile()
TextBox1.Text = OpenFileDialog1.FileName.ToString()
If Not (strm Is Nothing) Then
'insert code to read the file data
strm.Close()
MessageBox.Show("File Opened")
End If
End Sub
结束班
答案 0 :(得分:0)
首先关闭......这甚至不是目录。
"C:temp"
如果您希望OpenFileDialog1控件的初始目录位于应用程序所在的同一目录中......请尝试此操作...
OpenFileDialog1.InitialDirectory = Application.StartupPath