Rabu, Maret 18, 2009
C#.NET : konversi string to percent and dolars
untuk button1 adalah nameid dari tombol Format Text
ini untuk melakukan conversi ke dolar dan percent :
private void Button1_Click(object sender, System.EventArgs e)
{
this.TextBox2.Text = formatText(Convert.ToSingle(TextBox1.Text));
}
private void percentRadioButton_CheckedChanged(object sender, System.EventArgs e)
{
if (this.percentRadioButton.Checked)
{
formatText = new FormatNumbers.FormatSingle(FormatNumbers.returnPercentage);
}
}
private void dollarRadioButton_CheckedChanged(object sender, System.EventArgs e)
{
if (this.dollarRadioButton.Checked)
{
formatText = new FormatNumbers.FormatSingle(FormatNumbers.returnDollars);
}
}
private void Form1_Load(object sender, System.EventArgs e)
{
formatText = new FormatNumbers.FormatSingle(FormatNumbers.returnPercentage);
}
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar