社区
C#
帖子详情
datagrid控件的问题?
zxd35
2003-08-23 09:41:09
在datagrid控件中显示列标题,下面显示空白的网格,某些列可以为其他控件,例如combobox控件,在这些空白的网格中可以输入一些内容,可以在某一行下面插入一行,也可以删除一行,输入完成后,把这些网格中的内容写入到文件中去,datagrid控件不和任何数据库相连接,这个问题如何解决??万分感谢!!!
...全文
28
3
打赏
收藏
datagrid控件的问题?
在datagrid控件中显示列标题,下面显示空白的网格,某些列可以为其他控件,例如combobox控件,在这些空白的网格中可以输入一些内容,可以在某一行下面插入一行,也可以删除一行,输入完成后,把这些网格中的内容写入到文件中去,datagrid控件不和任何数据库相连接,这个问题如何解决??万分感谢!!!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
3 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
雪狼1234567
2003-08-23
打赏
举报
回复
combobox添加代码:
// Step 1. Derive a custom column style from DataGridTextBoxColumn
// a) add a ComboBox member
// b) track when the combobox has focus in Enter and Leave events
// c) override Edit to allow the ComboBox to replace the TextBox
// d) override Commit to save the changed data
// Step 2 - Use the combo column style
// Add 1 col with combo style
DataGridComboBoxColumn ComboTextCol = new DataGridComboBoxColumn();
ComboTextCol.MappingName = "custCity";
ComboTextCol.HeaderText = "Customer Address";
ComboTextCol.Width = 100;
ts1.GridColumnStyles.Add(ComboTextCol);
// Step 3 - Additional setup for Combo style
// a) make the row height a little larger to handle minimum combo height
ts1.PreferredRowHeight = ComboTextCol.ColumnComboBox.Height + 3;
// b) Populate the combobox somehow. It is a normal combobox, so whatever...
ComboTextCol.ColumnComboBox.Items.Clear();
ComboTextCol.ColumnComboBox.Items.Add("Chicago");
ComboTextCol.ColumnComboBox.Items.Add("Corvallis");
ComboTextCol.ColumnComboBox.Items.Add("Denver");
ComboTextCol.ColumnComboBox.Items.Add("Great Falls");
ComboTextCol.ColumnComboBox.Items.Add("Kansas City");
ComboTextCol.ColumnComboBox.Items.Add("Los Angeles");
ComboTextCol.ColumnComboBox.Items.Add("Raleigh");
ComboTextCol.ColumnComboBox.Items.Add("Washington");
// c) set the dropdown style of the combo...
ComboTextCol.ColumnComboBox.DropDownStyle = ComboBoxStyle.DropDownList;
zxd35
2003-08-23
打赏
举报
回复
xml如何使用?能给讲解一下吗?
cnhgj
2003-08-23
打赏
举报
回复
如果不和数据库连接的话,那么用xml,然后用DataSet绑定!要保存的时候用
StreamWriter myStreamWriter = new StreamWriter(xmlFilename);
DataSet1.WriteXml(myStreamWriter);
DataGrid
控件
用法详解
DataGrid
控件
是操作表格、数据库的重要
控件
,这里是其用法详解
vb
DataGrid
控件
的使用
DataGrid
控件
是一种类似于电子数据表的绑定
控件
,可以显示一系列行和列来表示 Recordset 对象的记录和字段。可以使用
DataGrid
来创建一个允许最终用户阅读和写入到绝大多数数据库的应用程序。
DataGrid
控件
可以在...
vb中
datagrid
控件
的详细使用方法
vb中
datagrid
控件
的详细使用方法,拿出来给大家看看!!!!是学习
datagrid
控件
的好助手
Datagrid
控件
及注册 MSDATGRD.OCX
解压后,点bat对
datagrid
控件
进行注册
在
DataGrid
控件
中设置单元格的数据显示格式.
在
DataGrid
控件
中设置单元格的数据显示格式.
C#
110,532
社区成员
642,574
社区内容
发帖
与我相关
我的任务
C#
.NET技术 C#
复制链接
扫一扫
分享
社区描述
.NET技术 C#
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
让您成为最强悍的C#开发者
试试用AI创作助手写篇文章吧
+ 用AI写文章