用c#创建一个下拉列表
本文关键字:一个 下拉列表 创建 | 更新日期: 2023-09-27 18:07:32
我是新的编程,我想一些帮助我如何创建一个下拉列表的通过/失败在c#。如有任何帮助,不胜感激
class Program
{
static void Main(string[] args)
{
Match match;
string pattern = @"'s*#'sfeatures+.+|'s*#'scalabash+.+";
string replacement = " Step #... ";
string result;
// Read input file
StreamReader inFile = new StreamReader(@"C:'Users'Desktop'file.txt");
string input = inFile.ReadToEnd();
inFile.Close();
// matching pattern
match = Regex.Match(input, pattern, RegexOptions.Multiline);
while (match.Success)
{
// Console.WriteLine("'{0}'character found: {1} ", match.Value, match.Index);
match = match.NextMatch();
}
// replace
result = Regex.Replace(input, pattern, replacement);
// Console.WriteLine(result);
File.WriteAllText(@"C:'Users'Desktop'file.txt", result);
您必须创建一个Windows窗体应用程序。
在VS:文件>新建>项目> Windows窗体应用程序
将ComboBox控件拖放到窗体上:
Toolbox> All Windows Forms> ComboBox
右键单击组合框>编辑项目
将您的项目添加到列表中并完成