<cell>
XMLファイルを解析していて、DataGridViewの各セルの背景色をXMLファイルのタグとタグの間の文字列に設定したいと思い</cell>
ます。
XMLファイルの構造は次のとおりです。
<?xml version="1.0" encoding="Windows-1252"?>
<Project StartTime="7" EndTime="12">
<Tabs>
<Page1 type="Tab">
<Grids>
<DataGridView>
<row> 'first row in DataGridView
<task name="task1" backcolor="White" /> 'first column on grid
<cell>White</cell> 'second column (contains a button)
<cell>Red</cell> 'third column
<cell>White</cell> 'fourth column
<cell>White</cell> 'fifth column
. . .
そして、これは私がセルの色を設定するために使用しているコードです:
If reader.Name = "cell" Then
Grid.Rows(i).Cells(i).Style.BackColor = Color.FromName("Color." & reader.ReadElementString("cell"))
End If
ただし、プログラムは色をまったく設定せず、各セルの背景色は白のままです。
他の誰かがこの問題に遭遇しましたか?問題を解決するための最良の方法は何ですか?