Salvete!さて、いくつかの苦しい苦痛の後、私はそれを理解しました。
まず、動的にロードするのではなく、フォームの列構造をハードコーディングしました。私はcsvファイルに列のデータを必要としないので、これは私の選択です。しかし、これにより、どの列がイメージ列であり、どの列がテキスト列であるかを正確に指定することができ、VSのGUIデザイナーでそのすべてを実行できます。
私はcsvを読み込んだので、2つの余分なイメージ列を作成し、対応するデータ値を表示しないように設定しました。
後でcsvファイルを保存すると、イメージ行をスキップしてデータ行に保存します。
Private Sub ImportCSV(ByVal whatgrid As DataGridView, ByVal whatfile As String)
Dim TextLine As String = ""
Dim SplitLine() As String
whatgrid.Rows.Clear()
Dim thisobject0 As Object
Dim thisobject1 As Object
If System.IO.File.Exists(whatfile) = True Then
Dim objReader As New System.IO.StreamReader(whatfile)
Do While objReader.Peek() <> -1
TextLine = objReader.ReadLine()
SplitLine = Split(TextLine, ",")
If SplitLine(0) = "false" Then thisobject0 = My.Resources.markfalse Else If SplitLine(0) = "true" Then thisobject0 = My.Resources.marktrue Else thisobject0 = My.Resources.blank
If SplitLine(1) = "false" Then thisobject1 = My.Resources.markfalse Else If SplitLine(1) = "true" Then thisobject1 = My.Resources.marktrue Else thisobject1 = My.Resources.blank
whatgrid.Rows.Add(thisobject0, SplitLine(0), thisobject1, SplitLine(1), SplitLine(2), SplitLine(3))
Loop
objReader.Close()
blankNewRow()
Else
MsgBox("File Does Not Exist")
End If
End Sub