Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2012
    Posts
    5
    Thanks
    2
    Thanked 0 Times in 0 Posts

    C# to say what day it is

    Im about to start school and mine has this day thing were each day is ether A day or B day it canges every day. how would i make a program to tell me what day it is in a message box? would you use if?
    Last edited by orangelight; 06-22-2012 at 05:19 AM.

  • #2
    New Coder
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Thanked 15 Times in 14 Posts
    I'm not sure if I really got what you're asking for. Is every week-day either named A or B? And you want to display which name the current day has?

    I think the easiest way would be to create a method which calculates if the current date (which you get by using a DateTime object and then use "yourDateTimeObject".today) is either called A or B.
    Then I would just call a messagebox to display the day's name.

    I would do it like this:
    Code:
    string getDayName() {
    day = "code for getting the day (either A or B)"
    return(day)
    }
    
    MessageBox.Show(day);


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •