abrupt123
abrupt123
采纳率42.9%
2015-10-17 09:16 阅读 1.7k

C#windows窗体应用程序

public partial class AddForm : Form
{
private int intTemp;
private user use = new user();
public AddForm(int temp, user u)
{
intTemp = temp;
use= u;
InitializeComponent();
}
private RedoForm parentForm;
public RedoForm pForm
{
get
{
return parentForm;
}
set
{
parentForm = value;
}
}
然后调用RedoForm窗体的方法
pForm.load();
这是RedoForm中load的方法
public void load()
{
LJQLDataContext dc = new LJQLDataContext();
this.listView1.Clear();
foreach (var result in dc.user)
{
user u = (user)result;
ListViewItem lvi = new ListViewItem();

            lvi.Tag = u;
            lvi.Text = "编号:" + u.uID + "名称:" + u.uName;
            lvi.Name = u.uID;
            lvi.ImageIndex = 0;
            lvi.ToolTipText = "双击查看详细信息!";
            this.listView1.Items.Add(lvi);
        }
    }
            但调用报错,pForm未初始化,还要怎么初始化
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

相关推荐