namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void buttonReturn_Click(object sender, EventArgs e) { if (textBoxBase.Text == "" || textBoxInterest.Text == "") { MessageBox.Show("กรุณากรอกช่องว่างให้ครบถ้วน", "Not found", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { double dblBase = Convert.ToDouble(textBoxBase.Text); double dblInterest = Convert.ToDouble(textBoxInterest.Text); double dblYear = (double)numericUpDownYear.Value; double dblReturn = 0.0; string strReturn = ""; int i = 1; do { dblReturn = dblBase * (dblInterest / 100); strReturn += "ผลตอบแทนปีที่ " + i.ToString() + " = " + dblReturn.ToString("#,###.##") + " บาท | เงินต้น = "+ dblBase + "\r\n"; dblBase = dblBase + dblReturn; i++; } while (i <= (int)numericUpDownYear.Value); MessageBox.Show(strReturn); } } } }
Sign up here with your email
ConversionConversion EmoticonEmoticon