【发布时间】:2014-01-27 22:14:09
【问题描述】:
在这里我打开一个文件,但我不会打开它然后移动到另一个目录中的文件夹,如果程序是这里的代码我到目前为止得到的代码
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
结束类
【问题讨论】:
-
你看过
System.IO.File类吗?
标签: vb.net openfiledialog