access其最大的优点是:简单易学!非计算机专业的人员,也能学会。所以用它作为数据库的入门来学习是非常不错的选择。本文主要讲诉怎样一步步搭建一个小型的ACCESS数据库今天在确认实习......
vb.net在内存中解压文件
Public Class Form1
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
'保存压缩文件
Dim fso As New SaveFileDialog
If fso.ShowDialog = Windows.Forms.DialogResult.OK Then
GzipFile(fso.FileName)
End If
End Sub
Private Sub GzipFile(ByVal FileName As String)
Try
'定义文件流,用于写入压缩流
Dim fs As FileStream = New FileStream(FileName, FileMode.Create, FileAccess.Write)
'定义压缩流,用于压缩数据
Dim compressStream = New GZipStream(fs, CompressionMode.Compress, False)
'定义写入操作流,用于向压缩流写入数据
Dim sw As StreamWriter = New StreamWriter(compressStream, System.Text.Encoding.GetEncoding("GB2312"))
sw.WriteLine(Me.RichTextBox1.Text)
sw.Close()
MsgBox("压缩文件成功")
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Sub
Private Function Decompress(ByVal FileName As String)
Dim DeCompressStr As String = ""
'定义文件流,用于读取数据
Dim fs As New FileStream(FileName, FileMode.Open, FileAccess.Read)
'定义压缩流,用于解压缩,生成解压流
Dim DecomprssStream As New GZipStream(fs, CompressionMode.Decompress, False)
'定义读取操作流,用于从压缩流读取数据
Dim sr As New StreamReader(DecomprssStream, System.Text.Encoding.GetEncoding("GB2312"))
'返回读取出的内容()
DeCompressStr = sr.ReadToEnd
sr.Close()
Return DeCompressStr
End Function
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
'打开压缩的文件,以读取其内容
Dim fso As New OpenFileDialog
If fso.ShowDialog = Windows.Forms.DialogResult.OK Then
Me.RichTextBox1.Text = Decompress(fso.FileName)
MsgBox("解压内容完成")
End If
End Sub
End Class
标签: vb.net在内存中解压文件PublicClassForm1
相关文章
- 详细阅读
- 详细阅读
- 详细阅读
-
Access2016数据库开发教程1详细阅读
第一章开发平台概述1.1盟威软件快速开发平台是什么?1.1.1概述《盟威软件快速开发平台(Access版)》是一款免费的快速开发平台。该平台主要用于企业中各种管理信息系统的开发,不会编程的......
2022-04-19 488 Access Access2016 Access2016数据库开发 数据库开发
- 详细阅读