使用添加到 c# 项目的 csv 文件作为组合列表的源
Use csv-files added to c# project as source for combolist
我有一个组合框,其中填充了 csv 文件中的内容。
在我的项目中,我有一个 app.config 文件,我在其中引用了这样的文件:
<setting name="ListOfThings" serializeAs="String">
<value>List.csv</value>
</setting>
我已经将文件添加到解决方案中,并将 "Copy To Output" 选项设置为 "Copy Allways",并且我尝试将 "Build Action" 设置为 Content/Compile,但我收到以下错误:
Error 67 'Project.Properties.Settings' does not contain
a definition for 'ListOfThings' and no extension method 'ListOfThings'
accepting a first argument of type 'Project.Properties.Settings'
could be found (are you missing a using directive or an assembly
reference?)
在我将 csv 文件添加到项目之前,我引用了具有完整路径的文件 "C:\temp\List.csv"(c:\temp\List.csv) ,有效。
有什么想法吗?
谢谢!
我不得不在 Settings.Designer.cs 文件中添加 csv 文件引用,现在它可以正常工作了!感谢所有建议:)
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("List.csv")]
public string ListOfThings {
get {
return ((string)(this["ListOfThings"]));
}
}
我有一个组合框,其中填充了 csv 文件中的内容。
在我的项目中,我有一个 app.config 文件,我在其中引用了这样的文件:
<setting name="ListOfThings" serializeAs="String">
<value>List.csv</value>
</setting>
我已经将文件添加到解决方案中,并将 "Copy To Output" 选项设置为 "Copy Allways",并且我尝试将 "Build Action" 设置为 Content/Compile,但我收到以下错误:
Error 67 'Project.Properties.Settings' does not contain a definition for 'ListOfThings' and no extension method 'ListOfThings' accepting a first argument of type 'Project.Properties.Settings' could be found (are you missing a using directive or an assembly reference?)
在我将 csv 文件添加到项目之前,我引用了具有完整路径的文件 "C:\temp\List.csv"(c:\temp\List.csv) ,有效。
有什么想法吗? 谢谢!
我不得不在 Settings.Designer.cs 文件中添加 csv 文件引用,现在它可以正常工作了!感谢所有建议:)
[global::System.Configuration.ApplicationScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("List.csv")]
public string ListOfThings {
get {
return ((string)(this["ListOfThings"]));
}
}