我正在编写一个程序,读取输入文件,然后显示名称列表给用户。我的代码如下:
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 15:53:08
我想你也可以挂掉给InitialiseComponent的电话,然后激活。这些将由设计器代码和事件的自然顺序处理。应该让你的代码更轻便一点。
https://stackoverflow.com/questions/9858201
复制相似问题