private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
Dictionary<string, LivePacketDevice> copyOfAdapters = find_adapter.Adapters;
copyOfAdapters.Remove(comboBox1.SelectedText);
Dictionary<string, LivePacketDevice> copyOfAdapters22 = copyOfAdapters;
}
啓動項目後,exeption被扔的NullReferenceException在comboBox_SelectedIndexChanged
型 'System.NullReferenceException' 的例外發生在......但是在用戶代碼中沒有處理
附加信息:未將對象引用設置爲對象的實例。
在第一行方法結束時。但是find_adapter
是在Form的構造函數中創建的。那麼錯誤在哪裏? 我真的不知道:/ THX
什麼是你的IDE告訴你的是空項目,如果你設置一個斷點? –
find_adapter爲空....但爲什麼在運行programm後立即拋出此問題,並且在單擊combobox後沒有? –
在調用此代碼之前,您顯然沒有將find_adapter設置爲任何東西(除null之外)... –