Hi
I am developing a windows application that connects to a sql database. I have a datagrid that has a datasource of a dataset. I am trying to color the rows of the datagrid based on a value inside of the dataset. I have read the article "Customizing the Windows Forms Datagrid" and I am having trouble figuring out where some of the code that has been provided needs to go. Any assistance would be greatly appreciated.
Thanks

Coloring Datagrid rows based on value inside of dataset
gidon
I have successfully colored an Individual Cell based on a value. Now if I could just color that entire row that would be fantastic.
mizd
I tried to put it in a private methods is says _myGrid (mygrid IN MYEXAMPLE) is DOES NOT CONTAIN DEFINITION FOR ROWS
Craig Spargo
http://www.syncfusion.com/FAQ/WindowsForms/Default.aspx#44
Brian Knox
Is this an example in C++ I am trying to use logic in vb and I am finding it difficult to translate the following code to vb syntax
<Code>
foreach(DataGridRow row in _myGrid.Rows)
{
bool isBold = (bool)row["isBold"].Value;
if (isBold)
{
row.DefaultCellStyle.Font = bold_font;
}
}
</Code>
any suggestions
Patrick D
grid.Rows[i].DefaultCellStyle.Color = someColor;
this will change the entire row style.
My code is in C# but the VB version is pretty much the same.
Hope it helps.
PParisot
// This is the style to change to matching rows
Font bold_font = new Font("Arial", 9F, FontStyle.Bold);
foreach(DataGridRow row in _myGrid.Rows)
{
bool isBold = (bool)row["isBold"].Value;
if (isBold)
{
row.DefaultCellStyle.Font = bold_font;
}
}
In the same manner you may cahnge Style.Color and other Style properties acording to your data.
Note that the (bool)row["isBold"].Value command will work only if all of the items will have true or false in them (null value will give an Exception).
Hope it helps.