using System;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double dNum = 0;
dNum = 32.123456789;
MessageBox.Show("Formated String " + string.Format("{0:n4}", dNum));
}
}
}
When you run this C# source code you will get "Formated String 32.1234"
No comments:
Post a Comment