Read content of a CSV file to a 2D-string array.

Namespace: ExpSuite
Assembly: FrameWork (in FrameWork.exe) Version: 1.0.0.0

Syntax

Visual Basic
Public Function ReadArr ( _
	szFile As String, _
	ByRef szArr As String(,), _
	pbStatus As ProgressBar _
) As String

Parameters

szFile
Type: System..::..String
File name of the CSV file.
szArr
Type: array<System..::..String,2>[,](,)[,][,]%
Array with the content. szArr() will be resized to the correct size.
pbStatus
Type: System.Windows.Forms..::..ProgressBar
Progress bar to show the progrees of parsing.

Return Value

Error message:
  • Empty: no error ocured.
  • File not found: szFile is empty or the file specified by szFile couldn't be found.
  • File is empty: File could be opened but is empty
  • System Error + Error description: A system error occured. See VB Help for the explanation of the error message.
  • Remarks

    ReadArr loads file with the file name szFile, parses the content and copies the data to szArr().
    Rules (if " is Quota and , is Separator):
  • " : mszQuota
  • , : Separator
  • row : cell,cell,cell
  • not quoted cells:
  • ab,cd -> two cells: ab and cd
  • ab"cd -> ab"cd
  • ab""cd -> ab""cd
  • ab" -> ab"
  • ab"" -> ab""
  • quoted cells:
  • "ab" -> ab
  • "ab,cd" -> ab,cd
  • "ab"cd -> ab and ignore cd
  • "ab"de" -> ab and ignore cd
  • ""abcd -> empty cell and ignore abcd
  • "ab""cd" -> ab"cd
  • "ab"",cd" -> ab"cd
  • """abcd" -> "abcd
  • last quoted cell in a row:
  • "abEOL -> ab
  • "ab"EOL -> ab
  • "ab""EOL -> ab"
  • "ab"""EOL -> ab"
  • "ab""cdEOL -> ab"cd
  • Empty row -> one empty cell
  • See Also