2
我正在写一个程序,它读取输入文件,然后向用户显示名称列表。 我编码如下:c窗口窗体加载#
Read the txt file
Store the data in a list
then call a method userint.add_names(names); //where names is a list containing first name and last name.
Created a new method in userint.cs as follows:
internal void add_localvars(List<names> name)
{
userinter userinterface = new userinter();
InitializeComponent();
listbox1.DataSource = name;
listbox1.DisplayMember = "first_name";
userInterface.Activate();
userinterface.Show();
}
我不知道为什么,是不是我装形式。我在上次声明中激活表单时出错,而且我不确定如何加载表单。我在互联网上尝试了一百种不同的东西。任何人都可以请帮忙。
谢谢
向我们显示错误消息。 – 2012-03-25 05:56:11
在WindowsFormsApplication2.exe中发生未处理的异常'System.NullReferenceException'类型 附加信息:未将对象引用设置为对象的实例。 – 2012-03-25 05:57:14
你初始化了'userInterface'吗? – 2012-03-25 05:58:45