Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 不显示实体框架中类中正在使用的任何内容_C#_.net_Winforms_Linq_Entity Framework - Fatal编程技术网

C# 不显示实体框架中类中正在使用的任何内容

C# 不显示实体框架中类中正在使用的任何内容,c#,.net,winforms,linq,entity-framework,C#,.net,Winforms,Linq,Entity Framework,代码在datagridview 为什么? class-classman { 公共int id; 公共字符串名称; } 私有void Form2_加载(对象发送方、事件参数e) { testtelContext db=新的testtelContext(); 列表qry=(从p到db.firstlasts) 加入我的名字 在p.Idfname上等于i.Idfname 选择新同学 { id=p.idfl, name=i.fname }).ToList(); BindingSource bs=新的Bin

代码在
datagridview
为什么?

class-classman
{
公共int id;
公共字符串名称;
}
私有void Form2_加载(对象发送方、事件参数e)
{
testtelContext db=新的testtelContext();
列表qry=(从p到db.firstlasts)
加入我的名字
在p.Idfname上等于i.Idfname
选择新同学
{
id=p.idfl,
name=i.fname
}).ToList();
BindingSource bs=新的BindingSource();
bs.DataSource=qry;
dataGridView1.DataSource=bs;
}
bindingsource中有值,但它不显示dataGridView5 show picture

可能需要:

dataGridView1.DataBind();
设置数据源后立即执行。

可能需要:

dataGridView1.DataBind();

在您设置数据源之后。

我的回答是否有助于您回答此问题?您应该更新您的问题,而不是将非答案作为您自己问题的答案。我的回答是否有助于您回答此问题?您应该更新您的问题,而不是将非答案作为您自己问题的答案。