Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Enumeration for months?

Posted on 2006-07-20
Medium Priority
Last Modified: 2010-04-16
Hi all, I'm trying to convert a string value selected from a drop down control to a numeric value and having trouble.  List of values are the months, spelled out (January, February,...).  When the user selects one of these, I want to be able to convert this TimeFrame.SelectedValue to an int, January = 1, Feb =2....   integer variable is monthstart.

I don't have much (ok, any) experience with enumerations, but from what I do understand about the language, this is probably way to go.  How can I make the conversion??

Any help would be appreciated,

Thanks in advanced

Question by:aaalife
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

osmantemiz earned 2000 total points
ID: 17148033
first of all you dont have to use enumaration for that kind of thing just do that

TimeFrame.Items.Add("Select Month");
.// just add like this

Now if you get the TimeFrame.SelectedValue it will return your int :)

Expert Comment

ID: 17148038
sorry... Not SelectedValue you should get SelectedIndex ...

Author Comment

ID: 17148116
i need January to =1, will TimeFrame.SelectedIndex start at 0, so i have to + 1, or does the index start with 1??

Author Comment

ID: 17148122
never mind, re-read your answer, got it.


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question