CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 18

Threaded View

  1. #5
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: Please Help... Simple Problem I can't solve please!

    Quote Originally Posted by Marcham89 View Post
    Okay thanks. Do you always need an "else" statement? (because for in this instance I know it cant be anything else)
    You know, but the compiler doesnt know. That's why it's complaining.

    Going back to what buser hinted at, why are you writing 12 IFs when you can just write:

    Month = DateTime.Now.ToString("MMMM");

    If you really must use 12 IFs, what's wrong with:

    Code:
    int month = DateTime.Now.Month;
    if(month == 1)
    ..
    elseif(month == 11)
    ..
    else
    ..
    Why convert everything to string all the time?
    Last edited by cjard; December 9th, 2008 at 08:27 PM.
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured