0

基本上,我在一个表单上有大约 40 个文本框,我想复制这些文本框,设置在我拥有的第一个框上,但是我复制了第一行并且我使用的保存设置没有复制,所以只有第一行框保存文本。代码是:

textBox1.Text = WindowsFormsApplication12.Properties.Settings.Default.Method.ToString();
textBox2.Text = WindowsFormsApplication12.Properties.Settings.Default.Price.ToString();
textBox3.Text = WindowsFormsApplication12.Properties.Settings.Default.PerHour.ToString();
textBox4.Text = WindowsFormsApplication12.Properties.Settings.Default.Viable;

try
{
   WindowsFormsApplication12.Properties.Settings.Default.Method = textBox1.Text;
   WindowsFormsApplication12.Properties.Settings.Default.PerHour = Convert.ToInt32(textBox3.Text);
   WindowsFormsApplication12.Properties.Settings.Default.Total = Convert.ToInt32(textBox4.Text);
   WindowsFormsApplication12.Properties.Settings.Default.Viable = textBox40.Text;
   WindowsFormsApplication12.Properties.Settings.Default.Save();
}
catch (FormatException ex)
{
   MessageBox.Show("Error : Make sure you have only entered numbers! \n\n" + ex.ToString());
}
4

0 回答 0