Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Batadase Raw Colour


  • Please log in to reply
3 replies to this topic

#1 Saeed7007

Saeed7007

    CC Regular

  • Member
  • PipPipPip
  • 43 posts

Posted 21 July 2012 - 09:59 AM

hey my old bud!

i have a nice question for you

i wrote a small database using ms access. it has 3 coloums: id, count and fish

i want : in a specific row, if the third coloum > second col, the colour of row change to red...

i used a code in "DBGrid1DrawColumnCell", but when i want to add a new record, gets error.

(database : c:\db.mdb)

please help me.

Thanks.

Attached Files


  • 0

#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts
  • Location:Argentina
  • Programming Language:C, C++, C#, PHP, JavaScript, Transact-SQL, Bash, Others
  • Learning:Java, Others

Posted 21 July 2012 - 10:47 AM

hello saeed,
in order to change cell colors you can use :

DataGridView.Item(Column, Row).Style.BackColor = Color
DataGridView.Item(Column, Row).Style.ForeColor = Color
or
DataGridView.CurrentCell.Style.BackColor = Color
DataGridView.CurrentCell.Style.ForeColor = Color
  • 0

#3 Saeed7007

Saeed7007

    CC Regular

  • Member
  • PipPipPip
  • 43 posts

Posted 21 July 2012 - 10:59 AM

hey BlackRabbit

we don't have something like "DataGridView" in Delphi...
  • 0

#4 Luthfi

Luthfi

    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1320 posts
  • Programming Language:PHP, Delphi/Object Pascal, Pascal, Transact-SQL
  • Learning:C, Java, PHP

Posted 21 July 2012 - 09:07 PM

hey my old bud!

i have a nice question for you

i wrote a small database using ms access. it has 3 coloums: id, count and fish

i want : in a specific row, if the third coloum > second col, the colour of row change to red...

i used a code in "DBGrid1DrawColumnCell", but when i want to add a new record, gets error.

(database : c:\db.mdb)

please help me.

Thanks.


Hi Saeed,

I assume that the error is only happening when you have new record, right? I believe that error is caused by your effort to compare non-existent values. Remember that unless you have defined default values for your fields, they will initially be empty (null). Which is the case with your third and second column. So the error was caused by you comparing null value with another null value.

The best way to avoid this error is to give those columns default values of 0.
  • 0




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download