OPenFileDialog使用 VB

前端之家收集整理的这篇文章主要介绍了OPenFileDialog使用 VB前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

OPenFileDialog使用

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles Button1.Click

Dim myStream As System.IO.Stream

openFileDialog1.InitialDirectory = "c:\"

openFileDialog1.Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"

openFileDialog1.FilterIndex = 2

OpenFileDialog1.RestoreDirectory = True

If OpenFileDialog1.ShowDialog() = DialogResult.OK Then

MsgBox(OpenFileDialog1.FileName)

myStream = OpenFileDialog1.OpenFile()

If Not (myStream Is Nothing) Then

MessageBox.Show(myStream.Length.ToString)

myStream.Close()

End If

End If

End Sub

filename = OpenFileDialog1.FileName
PictureBox1.Image = System.Drawing.Image.FromFile(filename)

即时图片显示

有从服务器上直接把文件导出到本地路径,自然也可以从本地路径中直接读取文件。 好像只要取得远程的本地路径,然后用java类中读取文件的类读这个文件就行了。 FileInputStream ofi = new FileInputStream(文件路径+文件名); InputStreamReader in = new InputStreamReader(ofi,"GBK"); BufferedReader oBufReader = new BufferedReader(in); 然后用readLine()方法逐行读取了。 至于写入数据库,只要把读取的内容按你需要拆分开来,insert到数据库就行了。

猜你在找的VB相关文章