如何解决Error 331 Argument 1:无法转换 [英] How do I resolve the Error 331 Argument 1: cannot convert
问题描述
void client_SaveNewBrandCompleted(object sender, SaveNewBrandCompletedEventArgs e)
{
m_SelectedBrand = e.Result;
m_SelectedBrandName = acbBrand.Text = newBrand;
CompaniesDictionaryCache.CompaniesCache.Brands.Add(e.Result, newBrand);
acbBrand.ItemsSource = null;
acbBrand.ItemsSource = CompaniesDictionaryCache.CompaniesCache.Brands;
tbNewBrand.Text = string.Empty;
MessageBox.Show("New brand saved");
}
错误331参数1:无法从'Adcheck.ServiceReference1.SaveNewBrandResponse'转换为'int'D:\ Factory \ hmy code \ BMI \Adcheck \Adcheck \ Controls \Contents\GeneralCompanyInfomation.xaml.cs 221 64 Adcheck
Error 331 Argument 1: cannot convert from 'Adcheck.ServiceReference1.SaveNewBrandResponse' to 'int' D:\Factory\factory code\BMI\Adcheck\Adcheck\Controls\Contents\GeneralCompanyInfomation.xaml.cs 221 64 Adcheck
推荐答案
我想问题就出在这一行:
I guess the problem is in this line:
m_SelectedBrand = e.Result;
检查m_SelectedBrand是否为int,如果是这样你应该像这样把e.Result转换为int:
Check if m_SelectedBrand is and int,and if so you should cast e.Result to int like this:
m_SelectedBrand =(int) e.Result;
当然,如果e.Result是int,这将有效。如果不是,则必须将此值存储在不同类型的变量中
Of course,this will work if e.Result is an int. If if isn't,you'll have to store this value in a different type of variable
这篇关于如何解决Error 331 Argument 1:无法转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!