【发布时间】:2015-02-09 11:01:58
【问题描述】:
我对 c# 有点陌生,我有一个任务要做:
谁能帮助我提供按钮代码,如何将美元转换为欧元?
这就是到目前为止所做的:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && e.KeyChar != '.')
{
e.Handled = true;
}
// only allow one decimal point
if (e.KeyChar == '.' && (sender as TextBox).Text.IndexOf('.') > -1)
{
e.Handled = true;
}
}
private void checkedListBox1_ItemCheck(object sender, ItemCheckEventArgs e)
{
for (int ix = 0; ix < checkedListBox1.Items.Count; ++ix)
if (ix != e.Index) checkedListBox1.SetItemChecked(ix, false);
}
private void checkedListBox2_ItemCheck(object sender, ItemCheckEventArgs e)
{
for (int ix = 0; ix < checkedListBox2.Items.Count; ++ix)
if (ix != e.Index) checkedListBox2.SetItemChecked(ix, false);
}
private void button1_Click(object sender, EventArgs e)
{
}
}
}
【问题讨论】:
-
为什么需要
checkedListBox才能将美元兑换成欧元?
标签: c# checkedlistbox