enum problems

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Robert Crago

    enum problems

    Hi there,

    I am using an enum in a switch statement as follows:

    switch (tabControl1.se lectedIndex)
    {
    case TabPage.SETUPTA B:
    ...
    break;

    ... etc
    }

    enum TabPage: int {SETUPTAB, RUNTAB}

    But the compiler keeps telling me:
    "Cannot implicitly convert type TabPage to int"

    I can get around it by using (int)TabPage.SE TUPTAB in the
    case. But I shouldn't have to (or should I?)

    What am I doing wrong?

    Thanks,

    Robert
  • Mattias Sjögren

    #2
    Re: enum problems

    Robert,

    Have you tried

    switch ((TabPage)tabCo ntrol1.selected Index)



    Mattias

    --
    Mattias Sjögren [MVP] mattias @ mvps.org

    Please reply only to the newsgroup.

    Comment

    Working...