user451244
user451244

Reputation: 31

Visual C# .NET Messagebox

My question is can we write:

String s="Sarath";
MessageBox.Show("My Name is Sarath {0}",s);

I want to get the name at the {0}..... Is there any way...

Thanks in advance.

Upvotes: 3

Views: 231

Answers (2)

lesderid
lesderid

Reputation: 3430

string myName = "Sarath";
MessageBox.Show(String.Format("My name is {0}.", myName));

Upvotes: 2

Caspar Kleijne
Caspar Kleijne

Reputation: 21864

use String.Format for that ;)

Upvotes: 4

Related Questions