异常详细信息: System.FormatException: 输入字符串的格式不正确。 请问是怎么回事该怎么处理啊

如题所述

第1个回答  2020-04-17

//在这段出错的代码上加上。

try{

//代码。}catch(Exceptionex){

}

代码如下:privatevoidbtnImport_Click(objectsender,EventArgse){

if(this.CheckItems()){

stringselectedValue=this.dropFiles.SelectedValue;stringpath=Path.Combine(this._dataPath,Path.GetFileNameWithoutExtension(selectedValue));

ImportAdapterimporter=TransferHelper.GetImporter(this.dropImportVersions.SelectedValue,newobject[0]);---这一行报错

intcategoryId=this.dropCategories.SelectedValue.Value;int?brandId=this.dropBrandList.SelectedValue;ProductSaleStatusdelete=ProductSaleStatus.Delete;

if(this.radInStock.Checked){delete=ProductSaleStatus.OnStock;

}if(this.radUnSales.Checked){delete=ProductSaleStatus.UnSale;}

if(this.radOnSales.Checked){delete=ProductSaleStatus.OnSale;}selectedValue=Path.Combine(this._dataPath,selectedValue);

if(!File.Exists(selectedValue)){

扩展资料:

字符修改步骤

1、首先打开vs2017。

2、新添加一个项目。

3、选择一个类库。

4、就在这个cs类中写,方法的目的就是给所有的字符串后边添加@符号。

5、先创建方法名词,这里就起名addChars。

6、填充里面的方法,并重新改造一下,将方法改为静态public static string addChars(this string str){return str + "@";}。

7、新建一个asp.net网站知,将创建好的扩展方法引入。

8、下面开道始写测试代码,创建2个label出来。

9、最后后台调用扩展方法,看结果就完成了。

相似回答
大家正在搜