Advertisement
Advertisement
| 01.18.2008 at 06:30AM PST, ID: 23093338 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: |
...
da=new SqlDataAdapter("select * from CTRX_CS",conn);
ds=new DataSet();
da.Fill(ds);
ds.Tables[0].TableName="CTRX_CS";
dataGrid1.DataMember = "CTRX_CS";
dataGrid1.DataSource = ds;
...
private void dataGrid1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
int r=dataGrid1.CurrentRowIndex;
int c=dataGrid1.CurrentCell.ColumnNumber;
// only 1st row is interesting for this
if (dataGrid1.CurrentCell.ColumnNumber==0)
{
switch( ds.Tables[0].Rows[dataGrid1.CurrentRowIndex]["TIP"].ToString() )
{
case "SHOP":
// now what ? I want current cell forecolor red..
break;
case "BAR":
// color cell blue
break;
case "TEST":
// color cell green
break;
}
}
}
|