Solved

C# -- Today's Date ?

Posted on 2009-07-10
2
2,418 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
2 Comments
 
LVL 142

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

758 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now