‘读取图片文件到内存
Dim buff As Byte() = 样张字段的值 'Rows里的索引号根据您的要求改
' 在PictureBox中显示
' If buff.Length > 0 Then
Dim ms As New IO.MemoryStream(buff)
ms.Position = 0
PictureBox1.Image = System.Drawing.Image.FromStream(ms)
‘===
‘启动文件
Dim psInfo As New System.Diagnostics.ProcessStartInfo(“d:\ww.txt”)
psInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal
Dim myProcess As Process = System.Diagnostics.Process.Start(psInfo)
‘读取文本文件
Public Function loadfile(ByVal filename As String) As String
Dim enc As Encoding
Dim file As FileStream = New FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)
If file.CanSeek Then
Dim bom(3) As Byte
file.Read(bom, 0, 4)
If ((bom(0) = &HEF And bom(1) = &HBB And bom(2) = &HBF) Or (bom(0) = &HFF And bom(1) = &HFE) Or (bom(0) = &HFE And bom(1) = &HFF) Or (bom(0) = 0 And bom(1) = 0 And bom(2) = &HFE And bom(3) = &HFF)) Then ‘判断是否是UNICODE字符集
enc = Encoding.Unicode
Else
enc = Encoding.Default
End If
file.Seek(0, SeekOrigin.Begin)
Else
enc = Encoding.Default
End If
Dim filebyte(file.Length) As Byte
file.Read(filebyte, 0, file.Length)
'转成系统对应的编码字符()
Dim myencoder As Encoding = enc
file.Close()
file = Nothing
Return New String(myencoder.GetChars(filebyte))
End Function