Value of type 'Integer' cannot be converted to 'System.Drawing.Color'.


 

Setting one of a control's color property using RGB values causes an error stating that the "Value of type 'Integer' cannot be converted to 'System.Drawing.Color'."

 

The following produces an error:

 

Me.AxctSchedule1.set_BarBackColor(nItem, nBar, RGB(0, 0, 255))

 

The color value must be converted to a UInt32 value.

 

Example:

 

Me.AxctSchedule1.set_BarBackColor(nItem, nbar, Convert.ToUInt32(ColorTranslator.ToOle(Color.FromArgb(0, 0, 255))))

 

Example:

 

Me.AxctSchedule1.set_BarBackColor(nItem, nBar, Convert.ToUInt32(ColorTranslator.ToOle(Color.Blue)))