嗨,我想收集this库的输出到列表框中。不能添加字符串到列表框
下面是从测试项目代码一部分,我试图修改:
public partial class Form1 : Form
{
D.Net.Clipboard.ClipboardManager Manager;
public Form1()
{
InitializeComponent();
Manager = new D.Net.Clipboard.ClipboardManager(this);
Manager.Type = D.Net.Clipboard.ClipboardManager.CheckType.Text;
Manager.OnNewTextFound += (sender, eventArg) =>
{
button1.Text = eventArg; //just testing, working correctly
listBox1.Items.Add(eventArg); //does not show neither result nor any error
MessageBox.Show(String.Format("New text found in clipboard : {0}", eventArg));
};
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("test"); //working correctly
}
}
问题是当我尝试添加项目到它什么也不做的名单,以及代码进一步线(以这个功能)根本不运行。
我试图通过一些自定义类和不同的表达式来修复它,但没有为我工作(是的,我是一个noob)。还试图用textBox来做,结果是一样的,但按钮上的文本会按照它应该改变。
看起来像完全跛脚的问题,但我花了近5个小时的谷歌搜索,阅读微软文档,SO,最接近我可以得到的是this,因为我可以看到东西建议那里已经实施。
;',做了'MessageBox'工作是否正确? –
尝试使用'listBox1.Items.Add(eventArg.ToString());'看看是否有效。 –
'button1.Text = eventArg;'甚至不会为我编译。 – Ulric