{"id":992,"date":"2009-04-14T02:25:35","date_gmt":"2009-04-13T17:25:35","guid":{"rendered":"http:\/\/gigasmegas.com\/?p=992"},"modified":"2009-04-15T04:37:56","modified_gmt":"2009-04-14T19:37:56","slug":"visual-basic-2008-tips-textfieldparser%e3%82%af%e3%83%a9%e3%82%b9%e3%81%a7csv%e3%83%95%e3%82%a1%e3%82%a4%e3%83%ab%e3%81%ae%e8%aa%ad%e3%81%bf%e8%be%bc%e3%81%bf%e3%80%81%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"http:\/\/gigasmegas.com\/?p=992","title":{"rendered":"VB.NET Tips TextFieldParser\u30af\u30e9\u30b9\u3067CSV\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\u3001\u89e3\u6790"},"content":{"rendered":"<p><a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/rokuz.com\/?p=');\"  href=\"http:\/\/rokuz.com\/?p=\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/rokuz.com\/wp-content\/uploads\/2009\/04\/snag-0117-400x234.png\" alt=\"TextFieldParser\u30af\u30e9\u30b9\u3067CSV\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\" title=\"TextFieldParser\u30af\u30e9\u30b9\u3067CSV\u30d5\u30a1\u30a4\u30eb\u306e\u8aad\u307f\u8fbc\u307f\" width=\"400\" height=\"234\" class=\"alignnone size-medium wp-image-993\" srcset=\"http:\/\/gigasmegas.com\/wp-content\/uploads\/2009\/04\/snag-0117-400x234.png 400w, http:\/\/gigasmegas.com\/wp-content\/uploads\/2009\/04\/snag-0117.png 494w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/a><\/p>\n<address>photo by <a onclick=\"javascript:pageTracker._trackPageview('\/outgoing\/www.flickr.com\/photos\/village9991\/');\"  href=\"http:\/\/www.flickr.com\/photos\/village9991\/\">village9991<\/a><\/address>\n<p>\u30c7\u30fc\u30bf\u3092\u6271\u3046\u30bd\u30d5\u30c8\u306a\u3089\u3001\u305f\u3044\u3066\u3044\u51fa\u529b\u65b9\u6cd5\u3068\u3057\u3066\u3001\u5bfe\u5fdc\u3057\u3066\u3044\u308bCSV\u5f62\u5f0f\u3068\u547c\u3070\u308c\u308b\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3002<\/p>\n<p>\u5f15\u7528\u7b26\u3068\u533a\u5207\u308a\u6587\u5b57\u3067\u3001\u30c7\u30fc\u30bf\u30b3\u30d4\u30fc\u304c\u7c21\u5358\u306b\u51fa\u529b\u3055\u308c\u3001\u30c7\u30fc\u30bf\u306e\u518d\u5229\u7528\u306b\u306f\u3088\u304f\u4f7f\u7528\u3055\u308c\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>CSV\u5f62\u5f0f\u30d5\u30a1\u30a4\u30eb\u306e\u30a4\u30f3\u30dd\u30fc\u30c8\u304c\u3067\u304d\u308c\u3070\u3001\u4ed6\u30bd\u30d5\u30c8\u3067\u4f5c\u6210\u3057\u305f\u4f4f\u6240\u9332\u306a\u3069\u304c\u518d\u5229\u7528\u3067\u304d\u308b\u53ef\u80fd\u6027\u304c\u5e83\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>\u3072\u3044\u3066\u306f\u3001\u5229\u7528\u30e6\u30fc\u30b6\u306e\u62e1\u5927\u306b\u3064\u306a\u304c\u308a\u307e\u3059\u306e\u3067\u3001\u30a4\u30f3\u30dd\u30fc\u30c8\u3001\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u306f\u5fc5\u9808\u6a5f\u80fd\u3067\u3059\u306d\u3002<\/p>\n<p><!--more--><\/p>\n<p>\u3055\u3066\u3001CSV\u5f62\u5f0f\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3001\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b\u306b\u306f\u3001\u5f15\u7528\u7b26\u3001\u533a\u5207\u308a\u6587\u5b57\u3092\u8a8d\u8b58\u3057\u3066\u3001\u6b63\u3057\u304f\u30c7\u30fc\u30bf\u5217\u3001\u30c7\u30fc\u30bf\u9805\u76ee\u3092\u89e3\u6790\u3001\u5207\u308a\u5206\u3051\u3067\u304d\u308c\u3070\u53ef\u80fd\u3068\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u666e\u901a\u3001\u6b63\u898f\u8868\u73fe\u3092\u4f7f\u7528\u3057\u3001\u30c7\u30fc\u30bf\u5217\u3054\u3068\u306b\u89e3\u6790\u3057\u3001\u30c7\u30fc\u30bf\u9805\u76ee\u3092\u914d\u5217\u306b\u683c\u7d0d\u3059\u308b\u65b9\u6cd5\u3092\u3068\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001.NET Framework2.0\u4ee5\u964d\u304b\u3089\u3001TextFieldParser\u30af\u30e9\u30b9\u306a\u308b\u3082\u306e\u304c\u5c0e\u5165\u3055\u308cCSV\u5f62\u5f0f\u306e\u89e3\u6790\u306a\u3069\u304c\u304a\u624b\u8efd\u306b\u884c\u3048\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u3053\u306e\u30d1\u30fc\u30b9\u51e6\u7406\u304c\u7c21\u5358\u306b\u884c\u3048\u308b\u3068\u3001\u5f8c\u306f\u3001\u751f\u6210\u30c7\u30fc\u30bf\u3092\u8aad\u307f\u66f8\u304d\u3059\u308b\u3060\u3051\u3068\u306a\u308b\u306e\u3067\u3001\u307b\u3093\u3068\u3001\u697d\u30c1\u30f3\u3067\u3059\u306d\uff01<\/p>\n<pre class=\"brush: vb; title: ; notranslate\" title=\"\">\r\n\r\n    Public Function CSVDataFieldRead(ByVal FileName As String, _\r\n                ByVal Delimiter As String, ByVal encode As Encoding)\r\n        CSVDataFieldRead = False\r\n        Try\r\n            Dim csvRecords As New System.Collections.ArrayList()\r\n            Dim TextFP As New FileIO.TextFieldParser(FileName, encode)\r\n\r\n            TextFP.TextFieldType = FileIO.FieldType.Delimited\r\n            TextFP.Delimiters = New String() {Delimiter}\r\n            TextFP.HasFieldsEnclosedInQuotes = True\r\n            TextFP.TrimWhiteSpace = True\r\n\r\n            While Not TextFP.EndOfData\r\n                csvRecords.Add(TextFP.ReadFields())\r\n            End While\r\n\r\n            Dim i As Integer\r\n            For Each m As String() In csvRecords\r\n                For Each FieldStr As String In m\r\n                    Console.WriteLine(FieldStr)\r\n                    i += 1\r\n                Next\r\n            Next\r\n\r\n            TextFP.Close()\r\n\r\n        Catch ex As Exception\r\n            Console.WriteLine(ex.Message)\r\n        End Try\r\n        CSVDataFieldRead = True\r\n\r\n        Call Style_FlexGridCust(FlexGridDataMap)\r\n\r\n    End Function\r\n\r\n    Private Sub Button1_Click(ByVal sender As System.Object, _\r\n                ByVal e As System.EventArgs) Handles Button1.Click\r\n        Call CSVDataFieldRead(&quot;C:test.csv&quot;, &quot;,&quot;, Encoding.GetEncoding(&quot;Shift_JIS&quot;))\r\n    End Sub\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>photo by village9991 \u30c7\u30fc\u30bf\u3092\u6271\u3046\u30bd\u30d5\u30c8\u306a\u3089\u3001\u305f\u3044\u3066\u3044\u51fa\u529b\u65b9\u6cd5\u3068\u3057\u3066\u3001\u5bfe\u5fdc\u3057\u3066\u3044\u308bCSV\u5f62\u5f0f\u3068\u547c\u3070\u308c\u308b\u30c6\u30ad\u30b9\u30c8\u30d5\u30a1\u30a4\u30eb\u3002 \u5f15\u7528\u7b26\u3068\u533a\u5207\u308a\u6587\u5b57\u3067\u3001\u30c7\u30fc\u30bf\u30b3\u30d4\u30fc\u304c\u7c21\u5358\u306b\u51fa\u529b\u3055\u308c\u3001\u30c7\u30fc\u30bf\u306e\u518d\u5229\u7528\u306b\u306f\u3088\u304f\u4f7f\u7528 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31,303,25,32],"tags":[306,272,308,337,336,254,304,307],"class_list":["post-992","post","type-post","status-publish","format-standard","hentry","category-sqlserver","category-vbnet","category-computer","category-database","tag-net","tag-272","tag-basic","tag-csv","tag-textfieldparser","tag-tips","tag-vb","tag-visual"],"_links":{"self":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/992","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=992"}],"version-history":[{"count":2,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/992\/revisions"}],"predecessor-version":[{"id":1007,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=\/wp\/v2\/posts\/992\/revisions\/1007"}],"wp:attachment":[{"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=992"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=992"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/gigasmegas.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=992"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}