[VB.NET]利用vb.net创建一个完全可编辑的DataGrid,从而实现操作Access数据库进行增,删,改的功能,前提是不用任何其他的Button

来源:互联网 发布:c语言and符号的优先级 编辑:程序博客网 时间:2024/06/04 00:49
VB.NET源码-156个实用实例哦……利用vb.net创建一个完全可编辑的DataGrid,从而实现操作Access数据库进行增,删,改的功能,前提是不用任何其他的Button
利用vb.net创建一个完全可编辑的DataGrid,从而实现操作Access数据库进行增,删,改的功能,前提是不用任何其他的Button
__________________________________________________________________________
如果您知道可以用Button时是怎么写的应该也可以知道不用时怎么写吧?
__________________________________________________________________________
呵呵,我还没试过,我只是用一个右键menu实现,还没试过没有其他东西
__________________________________________________________________________
晕倒~~
__________________________________________________________________________
二楼说的对!
__________________________________________________________________________
晕倒?何解?
__________________________________________________________________________
可以试试在DATAGrid中写事件
__________________________________________________________________________
2005

拉过去 就有了

一行代码也不用写
__________________________________________________________________________
给你个例子吧
dt类别= obj类别.Search类别(-1, " ").Tables[0];

DataGridTableStyle tableStyle = new DataGridTableStyle();

DataGridTextBoxColumn columnStyle = new DataGridTextBoxColumn();
columnStyle.MappingName = "类别ID ";
columnStyle.HeaderText = "类别ID ";
columnStyle.Width = 0;
columnStyle.ReadOnly = false;
tableStyle.GridColumnStyles.Add(columnStyle);

columnStyle = new DataGridTextBoxColumn();
columnStyle.MappingName = "类别名称 ";
columnStyle.HeaderText = "类别名称 ";
columnStyle.Width = 80;
columnStyle.ReadOnly = false;
tableStyle.GridColumnStyles.Add(columnStyle);

columnStyle = new DataGridTextBoxColumn();
columnStyle.MappingName = "说明 ";
columnStyle.HeaderText = "说明 ";
columnStyle.Width = 80;
columnStyle.ReadOnly = false;
tableStyle.GridColumnStyles.Add(columnStyle);

columnStyle = new DataGridTextBoxColumn();
columnStyle.MappingName = "图片 ";
columnStyle.HeaderText = "图片 ";
columnStyle.Width = 80;
columnStyle.ReadOnly = false;
tableStyle.GridColumnStyles.Add(columnStyle);

tableStyle.RowHeadersVisible =true;
tableStyle.MappingName = "类别 ";
dtg类别.TableStyles.Add(tableStyle);

dt类别.DefaultView.AllowNew = false;
dt类别.DefaultView.AllowEdit = false;
dt类别.DefaultView.AllowDelete = false;
dtg类别.DataSource =dt类别.DefaultView;
obj类别.Dispose();
__________________________________________________________________________
原创粉丝点击