如何从Windows窗体中的列表加载datagridview [英] how to load datagridview from list in windows form

查看:68
本文介绍了如何从Windows窗体中的列表加载datagridview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从数据库加载datagrid视图,但是当我运行以下代码时,它会显示列中字符串的长度。

I want to load datagrid view from database but when i run the following code, it shows the length of the string in the columns.

Entities db = new Entities();
            var dtstr = db.Shops.Select(d => d.ShopName).ToList();
            dataGridView1.DataSource = dtstr.ToList();
            dataGridView1.Refresh();



长度

5

5

4

5

另外如何在windows窗体中的datagridview中编辑和删除功能。



感激,

Usama


Length
5
5
4
5
Also how can is had edit and delete functionality in datagridview in windows form.

Thankful,
Usama

推荐答案

试试这个:



ASP.NET 2.0中的可编辑GridView [ ^ ]







Link2 [ ^ ]
Try this :

Editable GridView in ASP.NET 2.0[^]

or

Link2[^]


这篇关于如何从Windows窗体中的列表加载datagridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆