Minying's Blog

Just another WordPress.com weblog

Archive for 2008 年 12 月 1 日

在 Visual Basic 中從固定寬度的文字檔讀取

Posted by minying 於 1 十二月, 2008

TextFieldParser 物件提供簡便且有效的方式來剖析結構化的文字檔,例如記錄檔。

TextFieldType 屬性 (Property) 會定義檔案是否為分隔的檔案,或是具有固定寬度文字欄位的檔案。若要在固定寬度的檔案中指定可變動寬度的欄位,請將欄位寬度定義為 -1。

繼續閱讀文章 »

Posted in VB.NET | 已加上的標籤: | Leave a Comment »

在 Visual Basic 中從逗號分隔文字檔讀取

Posted by minying 於 1 十二月, 2008

TextFieldParser 物件提供簡便且有效的方式來剖析結構化的文字檔,例如記錄檔。TextFieldType 屬性 (Property) 會定義檔案是否為分隔的檔案,或是具有固定寬度文字欄位的檔案。

若要剖析以逗號分隔的文字檔

繼續閱讀文章 »

Posted in VB.NET | 已加上的標籤: | Leave a Comment »

在 Visual Basic 中從文字檔讀取

Posted by minying 於 1 十二月, 2008

My.Computer.FileSystem 物件的 ReadAllText 方法允許您從文字檔讀取。如果檔案的內容是使用 ASCII 或 UTF-8 之類的編碼方式,則可以指定檔案編碼方式。

如果您是從含擴充字元的檔案讀取,您將需要指定檔案的編碼方式。

繼續閱讀文章 »

Posted in VB.NET | 已加上的標籤: | Leave a Comment »

VB.Net 如何過濾重複的陣列元素

Posted by minying 於 1 十二月, 2008

如何過濾重複的陣列元素

<< VB.Net 2005 >> 和<< VB.Net 2008 >> 的寫法!!

<< VB.Net 2005 >> 

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

        ‘ 一整數陣列
        Dim ary() As Integer = {1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3}

        ary = DistinctArray(ary) ‘ 過濾重複的陣列元素

        For Each i As Integer In ary ‘ 底下顯示過濾後的陣列
            MessageBox.Show(i)
        Next

    End Sub

繼續閱讀文章 »

Posted in VB.NET | 已加上的標籤: | Leave a Comment »

ADO 連線字串範例

Posted by minying 於 1 十二月, 2008

ADO Connection String Samples

This page contains sample ADO connection strings for ODBC DSN / DSN-Less, OLE DB Providers, Remote Data Services (RDS), MS Remote, and MS DataShape.Also included are ADO.NET connection strings for MySQL, ODBC, OLE DB, Oracle, and SQL Server .NET Data Providers.

These sample connection strings are compiled by Carl Prothman, a Microsoft ASP.NET MVP and Microsoft Certified Professional (MCP)

If you have an ADO or ADO.NET connection string that is not listed below, or you see an connection string that does not have the correct setting, please send an email to Carl Prothman.  Thanks!

繼續閱讀文章 »

Posted in VB.NET | 已加上的標籤: , | Leave a Comment »