Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataBind on BackColor Property

Status
Not open for further replies.

swreng

MIS
Jun 22, 2006
90
GR
Dear all,

In a db table i have 3 columns for the backcolor of a specific object in my form, which is changing according to the record one column is for Red the other for Green and the last for Blue.(the column's names are colr,colg,colb)

So i am trying to to bind the backcolor property of the object with the columns and does'nt work.

If i write it like this then i have the error:
Can not bind to property BackColor.R

this.lblcode.DataBindings("Backcolor.R",ds_data,"table.colr");
this.lblcode.DataBindings("Backcolor.G",ds_data,"table.colg");
this.lblcode.DataBindings("Backcolor.B",ds_data,"table.colb");

Of course a solution is to save the value of each column in local variables for the current row of dataset and then:

lblcode.BackColor.R=var1;
lblcode.BackColor.G=var2;
lblcode.BackColor.B=var3;

but i wondering if it's possible to do it with databindings

Any ideas?

Many Many thanks!
 
DataBinding is available within datacontrols like GridView, FormView, DetailsView, Repeater. if the label is not within one of these controls then assign the property manually.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top