在商品信息窗口中有个datagridview,是商品信息表,里面有一列是选择框。
现在我要在采购订货单中的窗体中将在商品信息窗口中选中的那些项添加到
采购订货单中的datagridview数据表格中,如何实现?
现在我要在采购订货单中的窗体中将在商品信息窗口中选中的那些项添加到
采购订货单中的datagridview数据表格中,如何实现?
解决方案 »
- text_Changed事件和button_Click事件
- asp.net gridview 问题
- 如何让StatusStrip控件中toolstripstatuslabel产生自动换行功能?
- 请高手能给出 用委托 事件 异步 多线程 等方法写的一些程序 最好有注释
- ListBox的问题!!
- C#可以实现BT下载的功能吗!
- 传到空间上要发布网站吗
- 有没有办法将IHTMLDocument2对象保存为mht类型的文件?
- 求一正则表达式啊
- 如何查找一个List<byte>数组里面的 '4c' 的位置
- 生成的dll文件,为何改名后,就无法被别的程序引用了呢?
- 求dataGridView自定义列 的代码
using System.Collections.Generic;
using System.Text;
using System.Windows .Forms ;
using System.Data;
using System.Configuration;
using System.Data.SqlClient;namespace Dataset4
{
class Program
{
class MyForm : Form
{
public DataGridView grid1;
public DataGridView grid2;
public MyForm()
{
grid1 = new DataGridView();
grid1.Dock = DockStyle.Top;
grid2 = new DataGridView();
grid2.Dock = DockStyle.Top;
this.Controls.Add(grid1);
this.Controls.Add(grid2);
}
}
static void Main(string[] args)
{
string con = "Data Source=.;Initial Catalog=Northwind;Integrated Security=True";
DataSet set = new DataSet();
string sqlStr = "select * from Customers";
SqlDataAdapter adapter = new SqlDataAdapter(sqlStr, con);
adapter.Fill(set);
MyForm fm = new MyForm();
fm.grid2.DataSource = set.Tables[0];//绑定datatable对象
fm.ShowDialog();
}
}
}
PS 怎么小梁也来转战C#了。哈哈。顶一个。
有一个按纽,但按下按纽后,这些选中的项就依次添加到另一个窗口的 datagridview
中了,这个过程怎么实现????
for(int i=0;i<dataGridView1.SelectedRows.Count;i++)
{
if(dataGridView1.SelectedRows[i].Cells[1].Value.ToString()!="0")//判断是否选中
{
selsql="select num,mainnum,name,danwei,ckprice,plcprice,guige from tb_goods where id="+dataGridView1.SelectedRows[i].Cells[0].Value.ToString()+"";
}
frmCGDD cgdd = (frmCGDD)this.Owner;
abd.BindDGV_Sel(cgdd.dataGridView1, seladd);
}