Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. very simple Enumerators, help please?

very simple Enumerators, help please?

Scheduled Pinned Locked Moved Visual Basic
helpquestioncsharp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nadroj
    wrote on last edited by
    #1

    summers over school is in, yet again. heh, well, for the past 5 months or so on my school vacation, i hadnt used VB.net. now im lost again :S first off: im not asking you to do my homework, im asking for help.. my project is as follows: two text boxes, and one button. i need to write a program to find the difference (number of days) between 2 entered days (ex, day1 = monday, day2= friday, difference = 4 days. i have an enum like this:

    Private Enum DaysOfWeek
        Monday = 1
        Tuesday
        Wednesday
        Thursday
        Friday
        Saturday
        Sunday
    End Enum
    

    i also have 2 variables that i made of the enum type (startDay and endDay). i set startDay and endDay's value = their respective textboxes.text, which the user enters a day of week. i get cast from string to integer error (i know, because enums must only be integer values, right?) so how can i do this? (sorry if being broad, again, im not asking you to do my homework for me, im asking for help.) thank you ------------------------ Jordan. III

    S 1 Reply Last reply
    0
    • N Nadroj

      summers over school is in, yet again. heh, well, for the past 5 months or so on my school vacation, i hadnt used VB.net. now im lost again :S first off: im not asking you to do my homework, im asking for help.. my project is as follows: two text boxes, and one button. i need to write a program to find the difference (number of days) between 2 entered days (ex, day1 = monday, day2= friday, difference = 4 days. i have an enum like this:

      Private Enum DaysOfWeek
          Monday = 1
          Tuesday
          Wednesday
          Thursday
          Friday
          Saturday
          Sunday
      End Enum
      

      i also have 2 variables that i made of the enum type (startDay and endDay). i set startDay and endDay's value = their respective textboxes.text, which the user enters a day of week. i get cast from string to integer error (i know, because enums must only be integer values, right?) so how can i do this? (sorry if being broad, again, im not asking you to do my homework for me, im asking for help.) thank you ------------------------ Jordan. III

      S Offline
      S Offline
      Syed Abdul Khader
      wrote on last edited by
      #2

      Instead of casting string to enum use the Enum.Parse method to convert the string to Enum.

      N 1 Reply Last reply
      0
      • S Syed Abdul Khader

        Instead of casting string to enum use the Enum.Parse method to convert the string to Enum.

        N Offline
        N Offline
        Nadroj
        wrote on last edited by
        #3

        im off to bed, but, i WILL definetly check it out. iv never heard of that method before, ill look into it! thank you very much! ------------------------ Jordan. III

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups