[CLOSED] Register icons dynamically

  1. #1

    [CLOSED] Register icons dynamically

    Hi
    I would like to be able to register Icons dynamuically from, say a database table. Now im doing like this
    ScriptManager1.RegisterIcon(Icon.Building);
    But I want to do something like this.
    strIcon[0] = "Building";
    strIcon[1] = "Application";
    
    for (int i =0; i<2; i++)
    {
        ScriptManager1.RegisterIcon(Icon.strIcon[i]);    
    }
    Is that possible?

    /Mikael
  2. #2

    RE: [CLOSED] Register icons dynamically

    Hi Mikael,

    I believe you can parse any valid string into an Enum by using Enum.Parse.


    Hope this helps.


    Geoffrey McGill
    Founder
  3. #3

    RE: [CLOSED] Register icons dynamically

    Sorry, I dont get what you mean. Can you please show me.

    /mikael
  4. #4

    RE: [CLOSED] Register icons dynamically

    Theme theme= (Theme)Enum.Parse(typeof(Theme),*strIcon[i]);
    Hope this helps.


    Geoffrey McGill
    Founder
  5. #5

    RE: [CLOSED] Register icons dynamically

    Thanks
    I did like this and it worked great.

    
    
    
    Icon ico = (Icon)Enum.Parse(typeof(Icon), "Server");
    ScriptManager1.RegisterIcon(ico);
    /mikael
  6. #6

    RE: [CLOSED] Register icons dynamically

    oops... sorry about that. I just copy/paste that code from another file and forgot to convert to the Icon Enum.

    Geoffrey McGill
    Founder
  7. #7

    RE: [CLOSED] Register icons dynamically

    No problem!

Similar Threads

  1. [CLOSED] Register UserControl with Loader
    By softmachine2011 in forum 2.x Legacy Premium Help
    Replies: 1
    Last Post: Jul 16, 2012, 1:42 PM
  2. [CLOSED] Namespace Does not register
    By amitpareek in forum 1.x Legacy Premium Help
    Replies: 22
    Last Post: Nov 07, 2011, 10:10 AM
  3. [CLOSED] register xtype
    By RomualdAwessou in forum 1.x Legacy Premium Help
    Replies: 7
    Last Post: Nov 03, 2010, 6:49 PM
  4. Replies: 0
    Last Post: Apr 03, 2009, 5:47 AM
  5. combobox not show the first register of Store
    By DarkDucke in forum 1.x Help
    Replies: 0
    Last Post: Mar 04, 2009, 2:23 PM

Posting Permissions