【发布时间】:2015-02-06 20:00:15
【问题描述】:
无论出于何种原因,这看似简单是行不通的。具体来说,Foreach 循环给了我这个错误“错误 1 无法将类型 'char' 转换为 'string'”。我做了一些研究,虽然它不想暴露自己。希望大家知道,非常感谢您的帮助。
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace A_HtmlEditor
{
public partial class Form1 : Form
{
AutoCompleteStringCollection data = new AutoCompleteStringCollection();
public Form1()
{
InitializeComponent();
}
// The error occurs in the foreach loop below
private void textBox1_TextChanged(object sender, EventArgs e)
{
webBrowser1.DocumentText = textBox1.Text;
foreach(string s in textBox1.Text)
{
data.Add(s);
}
}
}
}
顺便说一句 我想知道,当我在这里时,你们中是否有人知道是否有可能找出是否有按钮单击,例如关机按钮?或者,如果这不可能,是否有办法知道计算机何时即将关闭。
再次感谢这一切,谢谢。
【问题讨论】: