2. 道歉(茶杯摔碎了 the cup broke)

原文链接:http://talk.oralpractice.com/article_12703.html

- What happened to my cup?

- I accidentally knocked it off the table and it broke. I'm really sorry.

- Don't worry about it. I've got another one I can use. 

我的茶杯怎么了?

我不小心将它由桌上碰下来,然后就摔破了。我真的很抱歉。

别放在心上,我还有另外一个可以用。

展开阅读全文

蛋碎了,这是什么情况!

09-10

using System;rnusing System.Collections.Generic;rnusing System.ComponentModel;rnusing System.Data;rnusing System.Drawing;rnusing System.Text;rnusing System.Windows.Forms;rnusing System.IO;rnusing System.Runtime.Serialization.Formatters.Binary;rnusing System.Runtime.Serialization;rnusing BankLibrary;rnrnnamespace CreatFileFormClassrnrn public partial class CreatFileForm : BankLibrary.BankUIFormrn rn private BinaryFormatter formatter = new BinaryFormatter();rnrn private FileStream output;rn public CreatFileForm()rn rn InitializeComponent();rn rnrn private void Form2_Load(object sender, EventArgs e)rn rnrn rnrn private void saveButton_Click(object sender, EventArgs e)rn rn SaveFileDialog fileChosser = new SaveFileDialog();rn DialogResult result = fileChosser.ShowDialog();rn string fileName;rnrn fileChosser.CheckFileExists = false;rnrn if (result == DialogResult.Cancel)rn return;rnrn fileName = fileChosser.FileName;rnrn if (fileName == "" || fileName == null)rn MessageBox.Show("Invalid file Name", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);rnrn elsern rn tryrn rn output = new FileStream(fileName, FileMode.OpenOrCreate, FileAccess.Write);rnrn saveButton.Enabled = false;rn enterButton.Enabled = true;rn rn catch(FileNotFoundException)rn rn MessageBox.Show("File Dose Not Exits", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);rn rn rn rnrn private void enterButton_Click(object sender, EventArgs e)rn rn string[] values = GetTextBoxValues();rnrn Record record = new Record();rnrn if (values[(int)TextBoxIndices.ACCOUNT] != "")rn rn tryrn rn int accountNumber = Int32.Parse(values[(int)TextBoxIndices.ACCOUNT]);rnrn if (accountNumber > 0)rn rn record.Account = accountNumber;rn record.FirstName = values[(int)TextBoxIndices.FIRST];rn record.LastName = values[(int)TextBoxIndices.LAST];rn record.Balance = Double.Parse(values[(int)TextBoxIndices.BALANCE]);rnrn formatter.Serialize(output, record);rnrnrn rn elsern rn MessageBox.Show("Invalid Account Number", "", MessageBoxButtons.OK, MessageBoxIcon.Error);rn rn rn catch (SerializationException)rn rn MessageBox.Show("Error writing to file", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);rn rn catch (FormatException)rn rn MessageBox.Show("Invalid Format", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);rn rn rn ClearTextBoxs();rn rn rnrn private void exitButton_Click(object sender, EventArgs e)rn rn if (output == null)rn rn tryrn output.Close(); rn catch (IOException)rn rn MessageBox.Show("Canot Exit Files", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);rn rn rn Application.Exit();rn rn rnrn这个蛋疼啊!代码没有错误!运行后新建了一个文件用于保存文件,然后输入数据点保存 出现异常!serializationException!这个异常的意思是:在序列化或反序列化期间出错引发的异常!怎么解决啊!对于高手应该不是什么大问题吧!给高分悬赏! 论坛

没有更多推荐了,返回首页