Winform绑定数据源的几种方式?
第一种:
DataSet ds=new DataSet ();
this.dataGridView1.DataSource=ds.Table[0]; 第二种:
DataTable dt=new DataTable();
this.dataGridView1.DataSource=dt; 第三种:
DataSet ds=new DataSet ();
this.dataGridView1.DataSource = ds.Tables["表名"]; 第四种:
DataSet ds=new DataSet ();
this.dataGridView1.DataSource = ds;
this.dataGridView1.DataMember = "表名"; 第五种:
ArrayList Al = new ArrayList();
this.dataGridView1.DataSource = Al; 第六种:
Dictionary<string, string> dic = new Dictionary<string, string>();
this.dataGridView1.DataSource = dic; 第七种:
DataView dv = new DataView();
this.dataGridView1.DataSource = dv; 第八种:
this.dataGridVi.DataSource = new BindingList<Object>(List<Object>);
Winform绑定数据源的几种方式?的更多相关文章
- DataGridView绑定数据源的几种方式
使用DataGridView控件,可以显示和编辑来自多种不同类型的数据源的表格数据. 将数据绑定到DataGridView控件非常简单和直观,在大多数情况下,只需设置DataSource属性即可.在绑 ...
- 【转】DataGridView绑定数据源的几种方式
第一种:DataSet ds=new DataSet (); this.dataGridView1.DataSource=ds.Table[0]; 第二种:DataTable dt=new DataT ...
- Winform绑定图片的三种方式
1.绝对路径: this.pictureBox2.Image=Image.FromFile("D:\\001.jpg"); 2.相对路径: Application.StartupP ...
- C# DataGridView绑定数据源的几种常见方式
开始以前,先认识一下WinForm控件数据绑定的两种形式,简单数据绑定和复杂数据绑定. 1. 简单的数据绑定 例1 using (SqlConnection conn = new SqlConnect ...
- Android_安卓为按钮控件绑定事件的五种方式
一.写在最前面 本次,来介绍一下安卓中为控件--Button绑定事件的五种方式. 二.具体的实现 第一种:直接绑定在Button控件上: 步骤1.在Button控件上设置android:onClick ...
- 为input标签绑定事件的几种方式
为input标签绑定事件的几种方式 1.JavaScript原生态的方式,直接复制下面的代码就会有相应的效果 <!DOCTYPE html><html><head> ...
- MyBatis配置数据源的两种方式
---------------------siwuxie095 MyBatis 配置数据源的两种方式 1.配置方 ...
- angular学习笔记(三)-视图绑定数据的两种方式
绑定数据有两种方式: <!DOCTYPE html> <html ng-app> <head> <title>2.2显示文本</title> ...
- JS与JQ绑定事件的几种方式.
JS与JQ绑定事件的几种方式 JS绑定事件的三种方式 直接在DOM中进行绑定 <button onclick="alert('success')" type="bu ...
随机推荐
- ubtuntu 下安装Erlang R17
在Ubuntu 下 Erlang R17B 的安装的过程记录: 1 :如果你主机上没有安装jdk,那需先安装,安装过程如下: # sudo apt-get update (更新已安装的包) ...
- python 中BeautifulSoup入门
什么是BeautifulSoup? Beautiful Soup 是用Python写的一个HTML/XML的解析器,它可以很好的处理不规范标记并生成剖析树(parse tree). 它提供简单又常用的 ...
- C语言简易文法(无左递归)
<程序> -〉 <外部声明> | <函数定义><外部声明> -〉<头文件> | <变量> | <结构体> <头 ...
- Retrofit源码研究
2016-05-06 15:35:27 最近抽空研究了一下Retrofit源码,包括API使用.源码结构.使用到的设计模式.SDK的架构设计.作者设计/实现思路等,会形成一系列文章. 以前Retrof ...
- 简单研究Loader笔记
2015-11-11 18:25:34 1. Loader是什么? /** * Static library support version of the framework's {@link and ...
- C++ TR1 Function Bind
在C++ 11出现以前,C++的事件一般是通过回调形试来实现,如 void (*func)(int,int,int),其实际上是一种函数指针,在C中调用时是直接写函数名在参数列表中,而在C++中,大部 ...
- git 小结
git cherry-pick de0ec64 可将另一个分支中的提交 cherry-pick到当前分支来
- 看的oracle数据库视频 记的一点笔记
3个默认的用户 sys //网络管理员 权限由上到下降低 [最后加上 as sysdba] system //本地管理员 scott //普通用户 默 ...
- He faced a maximum sentence of three years.
Police raided his home in August and found more than 100g of marijuana. He faced a maximum sentence ...
- Mysql EF Code First
1.更新程序包EntityFramework->6.1.3 2.下载程序包MySql.Data.Entities(Ver:6.8.3) 3.修改config.cs或者web.config,包含以 ...