Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9209451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:50:45+00:00 2026-06-18T00:50:45+00:00

I have this code to color grid row based on column data (the grid

  • 0

I have this code to color grid row based on column data (the grid is from devexpress)

var
AColumn: TcxCustomGridTableItem;
gs: variant;
begin

  AColumn := (Sender as TcxGridDBTableView).GetColumnByFieldName('COLOR');

  gs := ARecord.Values[AColumn.Index];

  if VarType(gs) and VarTypeMask = varString or varUString then
    AStyle.Color := gs; //<<<----- exception

The field color is varchar (firebird) contain values like cllime, clred, etc…
but I get error ‘Could not convert variant of type (UnicodeString) into type (Boolean)’ at the line with exception comment. what should I change ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:50:46+00:00Added an answer on June 18, 2026 at 12:50 am

    I would replace your if statement with the following. It uses the VarIsType function, which is more straight for Variant type checking and it converts string value stored in your Variant variable to color by using the StringToColor function:

    ...
    if VarIsType(gs, [varString, varUString]) then
      AStyle.Color := StringToColor(gs);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have written this line of code for setting row background color $(#gridSellIn tbody
For Andriod I have this code: public Tank(int color) { bounds = new RectF();
I have this code somewhere in my plugin: $('tr', $this).hover(function(){ var cur_color = null;
I have this code snippet: $(function() { $('.toolbar [id^=button]').on('click', function () { $(this) .css('background-color',
i have this CSS code: h1 { font-size:22px; color:#341C12; font-weight:normal; font-style:italic; } .h1color h1{
I have this method which does certain checks and applies a color code on
I have the following code: <html> <body> <div style=background-color: lightblue; onClick=alert(myArray[0][1])> this is a
I have this code: <TEXTFORMAT LEADING=2><P ALIGN=LEFT><FONT SIZE=9 COLOR=#2C363D LETTERSPACING=0 KERNING=0>A draft Ad for
I have this code which works fine : <script type=text/javascript> var $j = jQuery.noConflict();
I have copied the exact same code of the grid paging example from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.