Solved

C# -- Today's Date ?

Posted on 2009-07-10
2
2,424 Views
Last Modified: 2012-05-07
How can I get the "ISSUE #1" section
to work in ONE line without having
to create a "string today =....." VAR ?
--------------------------------------------
WORKS #1

      private void button1_Click(object sender, EventArgs e)
      {
          string today = String.Format("Today is {0}", DateTime.Today.ToString("D"));
          MessageBox.Show(today);
      }
--------------------------------------------
WORKS #2

      private void button1_Click(object sender, EventArgs e)
      {
          string today = "Today is " + DateTime.Today.ToString("D");
          MessageBox.Show(today);
      }
--------------------------------------------
ISSUE #1

      private void button1_Click(object sender, EventArgs e)
      {
          MessageBox.Show("Today is " + DateTime.Today.ToString("D")");
      }
0
Comment
Question by:finance_teacher
[X]
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 Comments
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 24827677
you have 1 quote too much at the end
0
 
LVL 6

Accepted Solution

by:
nandithaa earned 500 total points
ID: 24838301
private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("Today is " + DateTime.Today.ToString("D"));
        }
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video teaches viewers about errors in exception handling.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

636 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