This is a migrated thread and some comments may be shown as answers.

Images in Dropdown from Resourcefile

1 Answer 124 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Karl
Top achievements
Rank 1
Karl asked on 17 Apr 2012, 02:53 PM
Hi,
I keep getting the Error Cannnot convert type 'object' to 'System.Drawing.Image' on the line

element.Image = global::TelerikEditor.Properties.Resources.ResourceManager.GetObject(currCountry)

How would I change this?

private void LoadFlags( Telerik.WinControls.UI.RadDropDownList myDLL, Array Cntrys)
{
    myDLL.Items.Clear();
    foreach (string currCountry in Cntrys)
    {
        RadListDataItem element = new RadListDataItem();            
        element.Text = currCountry;
        element.Image = global::TelerikEditor.Properties.Resources.ResourceManager.GetObject(currCountry);
        element.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
        myDLL.Items.Add(element);
    }
}

1 Answer, 1 is accepted

Sort by
0
Karl
Top achievements
Rank 1
answered on 17 Apr 2012, 10:49 PM
Sorry to bother, I just figured out the correct way which is:

element.Image = (Image)global::TelerikEditor.Properties.Resources.ResourceManager.GetObject(currCountry.ToLower());

Karl
Tags
DropDownList
Asked by
Karl
Top achievements
Rank 1
Answers by
Karl
Top achievements
Rank 1
Share this question
or