I am trying to Heat map data for quick viewing, and faster analytics. however I have tried several different was to call upon my dependency. When I run the program I get the error, "object not an instance of an object. My program quickly changes between different data sets from a combobox. so i must add in condition for the selected combobox item, so i can read the correct column, as the column has the same name but always at the end of the dataset. Here is the coding I have right now.
public void heatmap()
{
string selected = comboBox1.SelectedItem.ToString();
if (selected == "General")
{
for(int i = 0; i < dataGridView1.Rows.Count; i++)
{
int val = Int32.Parse(dataGridView1.Rows[i].Cells[1].Value.ToString());
//No Change
if (val == 0)
{
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.WhiteSmoke;
}
//Big Drop
else if (val == 1)
{
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Navy;
}
// Slight Drop
else if (val == 2)
{
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.LightBlue;
}
// Slight Raise
else if (val == 3)
{
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.OrangeRed;
}
// Big Raise
else if (val == 4)
{
dataGridView1.Rows[i].DefaultCellStyle.BackColor = Color.Red;
}
is there another way to call upon the row, column cell value?? any help is appriciated!! this data set displays the columns in this order. Name, Price, Heat.