<script language="javascript">
  function checkInput() {

M 發表在 痞客邦 留言(0) 人氣()

 
注意調整Form1
 
 

M 發表在 痞客邦 留言(0) 人氣()

步驟一:加入[ICSharpCode.SharpZipLib.dll]元件
步驟二:將下列程式加入Class




Imports System


Imports System.Collections.Generic


Imports System.Text


Imports System.IO


Imports ICSharpCode.SharpZipLib.Zip


 


Public Class Zip


 


    ''' <summary>


    ''' 壓縮整個資料夾


    ''' </summary>


    ''' <param name="SourceDir">要壓縮的資料夾(完整路徑) </param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    ''' <param name="Password">密碼</param>


    ''' <param name="BackupOldFile">是否備份舊檔案</param>


    Public Sub ZipDir(ByVal SourceDir As String, ByVal TargetFile As String, ByVal Password As String, ByVal BackupOldFile As Boolean)


        Dim oZipDir As New ICSharpCode.SharpZipLib.Zip.FastZip()


        Try


            If Not Directory.Exists(SourceDir) Then


                Throw New Exception("資料夾不存在!")


            End If


 


            If BackupOldFile = True Then


                '判斷要產生的ZIP檔案是否存在


                If File.Exists(TargetFile) = True Then


                    '原本的檔案存在,把他ReName


                    File.Copy(TargetFile, TargetFile & "-" & DateTime.Now.ToString("yyyyMMddHHmmss") & ".back")


                    File.Delete(TargetFile)


                End If


            End If


 


            If Password <> "" Then


                oZipDir.Password = Password


            End If


            oZipDir.CreateZip(TargetFile, SourceDir, True, "")


        Catch


            Throw


        End Try


    End Sub


 


    ''' <summary>


    '''壓縮整個資料夾


    ''' </summary>


    ''' <param name="SourceDir">要壓縮的資料夾(完整路徑) </param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    ''' <param name="Password">密碼</param>


    Public Sub ZipDir(ByVal SourceDir As String, ByVal TargetFile As String, ByVal Password As String)


        Me.ZipDir(SourceDir, TargetFile, Password, True)


    End Sub


 


    ''' <summary>


    '''壓縮整個資料夾


    ''' </summary>


    ''' <param name="SourceDir">要壓縮的資料夾(完整路徑) </param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    Public Sub ZipDir(ByVal SourceDir As String, ByVal TargetFile As String)


        Me.ZipDir(SourceDir, TargetFile, "", True)


    End Sub


 


    ''' <summary>


    ''' 壓縮檔案


    ''' </summary>


    ''' <param name="SourceFiles">要壓縮的檔案(完整路徑)</param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    ''' <param name="Password">密碼</param>


    ''' <param name="BackupOldFile">是否備份舊檔案</param>


    Public Sub ZipFiles(ByVal SourceFiles As String(), ByVal TargetFile As String, ByVal Password As String, ByVal BackupOldFile As Boolean)


        Try


            If SourceFiles Is Nothing OrElse SourceFiles.Length <= 0 Then


                Throw New Exception("並未傳入檔案完整路徑")


            End If


 


            For i As Integer = 0 To SourceFiles.Length - 1


                If File.Exists(SourceFiles(i)) = False Then


                    Throw New Exception("要壓縮的檔案【" & SourceFiles(i) & "】不存在")


                End If


            Next


 


            If BackupOldFile = True Then


                '判斷要產生的ZIP檔案是否存在


                If File.Exists(TargetFile) = True Then


                    '原本的檔案存在,把他ReName


                    File.Copy(TargetFile, TargetFile & "-" & DateTime.Now.ToString("yyyyMMddHHmmss") & ".back")


                    File.Delete(TargetFile)


                End If


            End If


 


            Dim zs As New ZipOutputStream(File.Create(TargetFile))


            zs.SetLevel(9)


            '壓縮比


            If Password <> "" Then


                zs.Password = Password


            End If


 


            For i As Integer = 0 To SourceFiles.Length - 1


                Dim s As FileStream = File.OpenRead(SourceFiles(i))


                Dim buffer As Byte() = New Byte(s.Length - 1) {}


                s.Read(buffer, 0, buffer.Length)


                Dim Entry As New ZipEntry(Path.GetFileName(SourceFiles(i)))


                Entry.DateTime = DateTime.Now


                Entry.Size = s.Length


                s.Close()


                zs.PutNextEntry(Entry)


                zs.Write(buffer, 0, buffer.Length)


            Next


            zs.Finish()


            zs.Close()


        Catch


            Throw


        End Try


    End Sub


 


    ''' <summary>


    ''' 壓縮檔案


    ''' </summary>


    ''' <param name="SourceFiles">要壓縮的檔案(完整路徑)</param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    ''' <param name="Password">密碼</param>


    Public Sub ZipFiles(ByVal SourceFiles As String(), ByVal TargetFile As String, ByVal Password As String)


        Me.ZipFiles(SourceFiles, TargetFile, Password, True)


    End Sub


 


    ''' <summary>


    ''' 壓縮檔案


    ''' </summary>


    ''' <param name="SourceFiles">要壓縮的檔案(完整路徑)</param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    Public Sub ZipFiles(ByVal SourceFiles As String(), ByVal TargetFile As String)


        Me.ZipFiles(SourceFiles, TargetFile, "", True)


    End Sub


 


    ''' <summary>


    ''' 壓縮單一檔案


    ''' </summary>


    ''' <param name="SourceFiles">要壓縮的檔案(完整路徑)</param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    ''' <param name="Password">密碼</param>


    ''' <param name="BackupOldFile">是否備份舊檔案</param>


    Public Sub ZipFile(ByVal SourceFile As String, ByVal TargetFile As String, ByVal Password As String, ByVal BackupOldFile As Boolean)


        Me.ZipFiles(New String() {SourceFile}, TargetFile, Password, BackupOldFile)


    End Sub


 


    ''' <summary>


    ''' 壓縮單一檔案


    ''' </summary>


    ''' <param name="SourceFiles">要壓縮的檔案(完整路徑)</param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    ''' <param name="Password">密碼</param>


    Public Sub ZipFile(ByVal SourceFile As String, ByVal TargetFile As String, ByVal Password As String)


        Me.ZipFile(SourceFile, TargetFile, Password, True)


    End Sub


 


    ''' <summary>


    ''' 壓縮單一檔案


    ''' </summary>


    ''' <param name="SourceFiles">要壓縮的檔案(完整路徑)</param>


    ''' <param name="TargetFile">要產生的Zip檔案(完整路徑檔名)</param>


    ''' <returns></returns>


    Public Sub ZipFile(ByVal SourceFile As String, ByVal TargetFile As String)


        Me.ZipFile(SourceFile, TargetFile, "", True)


    End Sub


 


    ''' <summary>


    ''' 解壓縮


    ''' </summary>


    ''' <param name="SourceFile">要解壓縮的Zip檔案(完整路徑檔名) </param>


    ''' <param name="TargetDir">解壓縮後存放的資料夾路徑(完整路徑) </param>


    ''' <param name="Password">密碼</param>


    Public Sub ExtractZip(ByVal SourceFile As String, ByVal TargetDir As String, ByVal Password As String)


        Dim oZip As New ICSharpCode.SharpZipLib.Zip.FastZip()


        Try


            '判斷要產生的ZIP檔案是否存在


            If File.Exists(SourceFile) = False Then


                Throw New Exception("要解壓縮的檔案【" & SourceFile & "】不存在,無法執行")


            End If


            If Password <> "" Then


                oZip.Password = Password


            End If


            oZip.ExtractZip(SourceFile, TargetDir, "")


        Catch


            Throw


        End Try


    End Sub


 


    ''' <summary>


    ''' 解壓縮


    ''' </summary>


    ''' <param name="SourceFile">要解壓縮的Zip檔案(完整路徑檔名) </param>


    ''' <param name="TargetDir">解壓縮後存放的資料夾路徑(完整路徑) </param>


    Public Sub ExtractZip(ByVal SourceFile As String, ByVal TargetDir As String)


        Me.ExtractZip(SourceFile, TargetDir, "")


    End Sub


 


End Class


 


 





M 發表在 痞客邦 留言(0) 人氣()





Imports System.Text


 


'全型轉半型


Public Function ToNchr(ByRef data As String) As String


  Dim sb As New StringBuilder


  Dim ascii As Integer = 0


 


  For Each c As Char In data.Replace("〔", "[").Replace("〕", "]").Replace("'", "'").ToCharArray()


    ascii = System.Convert.ToInt32(c)


    If ascii = 12288 Then


      sb.Append(System.Convert.ToChar(32))


    Else


      If ascii > 65280 And ascii < 65375 Then


        sb.Append(System.Convert.ToChar(ascii - 65248))


      Else


        sb.Append(System.Convert.ToChar(ascii))


      End If


    End If


  Next


 


  Return sb.ToString


End Function





M 發表在 痞客邦 留言(0) 人氣()





Imports System.IO


Imports System.Text


 


'檔案Anis轉成Unicode格式


Dim reader1 As New StreamReader("D:\TEST.DAT", Encoding.GetEncoding(0))


Dim writer1 As New StreamWriter("D:\TEST_Un.TXT", True, Encoding.Unicode)


 


writer1.Write(reader1.ReadToEnd)


writer1.Flush()


writer1.Close()


reader1.Close()





M 發表在 痞客邦 留言(0) 人氣()





Imports System.IO


Imports System.Text


 


'StreamWriter匯出文字檔


Dim sL_Path As String = "D:\AAA.csv"


Dim sw As StreamWriter = New StreamWriter(sL_Path, True, Encoding.Unicode)


If File.Exists(sL_Path) Then


  File.Delete(sL_Path)


End If


 


sw.WriteLine("開始")


sw.WriteLine("內容1")


sw.WriteLine("內容2")


sw.WriteLine("結束")


 


sw.Close()





M 發表在 痞客邦 留言(0) 人氣()


http://vb.ncis.com.tw/LMVB2.0/exp/exp.html
VB新增資料表或資料庫.
http://tw.knowledge.yahoo.com/question/question?qid=1607042107814
======================================================================================================================
設定資料新增或修改的警告視窗
----------------------------
DoCmd.SetWarnings False

M 發表在 痞客邦 留言(0) 人氣()

 
 
'--==[頁面]======================================================================--

M 發表在 痞客邦 留言(0) 人氣()

Sub test()
Dim dt As DataTable

M 發表在 痞客邦 留言(0) 人氣()

 
純粹分享在網路上收集的一些裝潢建議資料,將其資料做整理分類。
裝潢工程裡還有許多細節及專業的地方,小弟不才,沒有辦法一一列出,所以這邊只有列出,一般人常遇到的問題。小弟只單純希望此文章,對大家可以有所幫助,絕對沒有針對任何個人或公司,有任何攻擊或評論之行為。關於裡面分享的一些想法或做法,還是需要經過專業人員的評估是否可行,不一定適合每個現場。

M 發表在 痞客邦 留言(0) 人氣()

更新時指定字串參數“N”,指定其為unicode字元就行了,
update <table_name> set <filed_name>=N'我是難字:双喆堃’ where <condition>;

M 發表在 痞客邦 留言(0) 人氣()


 
 
--=================================== [頁面] ===============================================--

M 發表在 痞客邦 留言(0) 人氣()

« 1 2 3
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。