http://expert.csdn.net/Expert/topic/2945/2945426.xml?temp=1.908511E-02
解决方案 »
- 麻烦高手帮忙看下SQL语句那里错误。
- 在App_Code文件夹下面定义了database.cs类,为什么运行时候提示出错
- 求高手,DATEPART(weekday, GETDATE() + @@DATEFIRST)返回什么值啊
- 请问:想在前台jscript代码中调用后台事件?求救!
- webcontrol打印问题,帮忙解决!
- 上传文件浏览本地文件夹,指定默认路径和文件类型
- TreeView控件的字体如何改变?
- 我在B/S下打印报表时,打印机老是提示超时,什么原因,是不是报表太长,如何解决?
- 在出报表时抛出异常:Not enough memory for operation,请问是什么回事?
- 如何在sql server2000中创建存贮过程!(50)在线等!
- ASP.NET怎么把一些代码封装为DLL在BIN目录里面,然后再使用?谢谢
- ExecuteNonQuery执行出错,大家帮忙看看,谢谢.
试试这个
后缀名=System.IO.Path.GetExtension(文件名);
i=str.lastindex(".") //取得该文件名的最后一个。号
newtype=str.substring(i) //取得包括,号的后缀名
或者
newtype=str.substring(i+1) //直接取得后缀名
dim extentin as string=file.extention
返回文件路径名称: System.IO.Path.GetDirectoryName(string path)
改变或删除文件扩展名:System.IO.Path.ChangeExtension(string path,string ExtensionName)
ofd.Filter = "所有文件|*.*";
if(ofd.ShowDialog() == DialogResult.OK)
{
this.textBox1.Text = ofd.FileName;
string na = ofd.FileName.Substring(ofd.FileName.LastIndexOf(@"\")+1);
string leng = ofd.FileName.Substring(ofd.FileName.LastIndexOf(@".")+1);
int row = leng.Length;
na = na.Remove(na.LastIndexOf(@"."),row + 1);
this.textBox2.Text = na;
FileStream ff = new FileStream(this.textBox1.Text, FileMode.Open);
if(ff.Length > 2048000)
{
float r = ff.Length ;
r = r / 1024000;
MessageBox.Show("附件不能超过2M", "当前附件:" + r.ToString() +"M"); this.textBox1.Text = ""; //清空当前操作
this.textBox2.Text = "";
}
ff.Close();
}
string strFileName = oFile.FileName.ToLower();
int nIndex = strFileName.LastIndexOf(".");
strFileName = strFileName.SubString(nIndex+1);
后缀名=filename.SubString(filename.LastIndexOf("."));