C# winform 中如何设定让DATAGRID不绑定数据,而只做录入用
来源:互联网 发布:软件和信息服务业协会 编辑:程序博客网 时间:2024/05/22 08:12
【转自】 http://hi.baidu.com/afantihome/blog/item/efbc82d3386dd4dda9ec9ace.html
C# winform 中如何设定让DATAGRID不绑定数据,而只做录入用?
我想让它像EXCEL表一样录入用,
private void MakeDataSet()
{
// Create a DataSet.
myDataSet = new DataSet("myDataSet");
DataTable tCust = new DataTable("Table1");
// Create two columns, and add them to the first table.
DataColumn col1 = new DataColumn("Col1");
DataColumn col2 = new DataColumn("Col2");
tCust.Columns.Add(col1);
tCust.Columns.Add(col2);
// Add the tables to the DataSet.
myDataSet.Tables.Add(tCust);
// Create three customers in the Customers Table.
tCust.Rows.Add(tCust.NewRow());
tCust.Rows[0]["Col1"]="Cell1,1";
tCust.Rows[0]["Col2"]="cell1,2";
}
private void AddCustomDataTableStyle()
{
DataGridTableStyle ts1 = new DataGridTableStyle();
ts1.MappingName = "Table1";
// Set other properties.
ts1.AlternatingBackColor = Color.LightGray;
//
// Add cols with DataGridComboBoxColumn column style
DataGridTextBoxColumn Col1 = new DataGridTextBoxColumn();
TextCol.MappingName = "FilterCondition";
TextCol.HeaderText = "列1";
TextCol.Width = 200;
ts1.GridColumnStyles.Add(Col1);
DataGridTextBoxColumn Col2 = new DataGridTextBoxColumn();
TextCol.MappingName = "FilterCondition";
TextCol.HeaderText = "列2";
TextCol.Width = 200;
ts1.GridColumnStyles.Add(Col2);
//add the custom table style to the datagrid table styles
dataGrid1.TableStyles.Add(ts1);
}
- C# winform 中如何设定让DATAGRID不绑定数据,而只做录入用
- 绑定winform中DataGrid
- c# 如何将数据集或datagrid中的数据绑定到文本框中
- 居然在winform中如何为datagridview绑定数据都不知道了
- 怎样让DataSet只填充数据架构,而不填充数据
- C#中DataGrid 重新绑定数据的代码
- C# WPF中DataGrid的数据绑定(Binding)
- C# 中通用winform组件的数据绑定
- C# 中通用winform组件的数据绑定
- C# WinForm 中ComboBox数据绑定的问题
- [WinForm每日一帖] 如何使你的窗体样式固定,不因系统设定而变化
- 如何让 htmlunit 执行 javascript 时,不下载整个页面,而只返回url
- 如何让killall -9只杀掉你想要杀掉的进程而不殃及无辜?
- FLEX中datagrid数据绑定
- C#的WinForm中如何让窗体大小不能改变
- Ubuntu中让终端只显示当前路径,而不显示绝对路径
- 如何在c#中设定和控制DataGrid的列宽
- 动态绑定只针对函数而不针对字段域
- 仿163网盘无刷新多文件上传系统
- 导出DataGrid中的数据到Excel,Word,Text
- CSS基本布局16例
- 用proftpd构建ftp服务器
- DCOM技术自定义Excel模版报表组件的一些构思(适用于Excel 2003)
- C# winform 中如何设定让DATAGRID不绑定数据,而只做录入用
- 关于公民身份证号码15位与18位互相转化的问题
- vsftp配置全攻略
- 《数字技术与应用》
- 在DataGrid(WinForm)中改变符合指定条件的行颜色的方法
- [原创] WoW 自制新技能
- 解决wxutil .cpp(626) : error C2400: inline assembler syntax error in 'opcode'; found 'newline'
- C# WinForm中DataGrid列设置(列宽/列标题等)
- Linux下获得脚本当前执行路径的办法