求大神-找错误
private void button2_Click(object sender, EventArgs e)
{
if (listView1.SelectedIndices[0] < 0 || listBox2.SelectedIndex < 0)//if (listView1.SelectedIndices[0] < 0 || listBox2.SelectedIndex < 0)
{
MessageBox.Show("请先选择相应文件");
return;
}
double fPrice = 0;
string sPrice = textBox6.Text;
{
{
}
}
fPrice = Parse(sPrice);
{
}
FileStream fs = null;
try
{
string FilePath = Path + "\\" + listView1.SelectedItems[0].Text + "\\" + listBox2.SelectedItem.ToString();
FileInfo fi = new FileInfo(FilePath);
fs = File.Open(FilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
byte[] FileByte = new byte[fs.Length];
fs.Read(FileByte, 0, (int)fs.Length);
//日期设置
int pos = (int)GetLinePos(FileByte, 11);//日期位置23行
var PriceBytesByTen = Encoding.ASCII.GetBytes(GetPriceStr(fPrice, 10));//日期位置剩余10个可用字符
PriceBytesByTen.CopyTo(FileByte, pos + 26);//日期位置去除前26个字
fs.Seek(0, SeekOrigin.Begin);
fs.Write(FileByte, 0, FileByte.Length);
fs.SetLength(FileByte.Length);
MessageBox.Show("修改成功");
}
catch(Exception ex)
{
MessageBox.Show("修改失败:"+ex.Message);
if(fs!=null)
fs.Dispose();
}
}
}
}
大家好我是新人 代码是别人那里复制来的文本修改 修改成功后后面多了2位小数 .00 还有不可以输入符号
求大神帮忙修改下 去掉2位小数 和可以输入任何字符