嗨,我想收集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