从Datagridveiw到组合框的价值... [英] value from Datagridveiw to combobox...

查看:83
本文介绍了从Datagridveiw到组合框的价值...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从datagrid到combobox中获取值...该怎么办? help ,,

I''m trying to get a value from datagrid to combobox... How It can be done?? help,,,

推荐答案

foreach(gridviewrow gvr in Gridview1.Rows)
{
lstGridColumn.add(gvr.Cells[2].Text);
}



其中lstGridColumn是



where lstGridColumn is a

List<string></string>

类型.您需要遍历网格中的每一行,并从代码中由Cells [2]指定的每一列中提取值.

这用于asp.net网站和Web应用程序,如果它是Windows窗体应用程序,则可能需要使用datagrid的行索引.
除此之外,我们还需要更多有关您的问题的信息...请详细说明.

type. You need to iterate through each rows in the grid and extract the value from each Column specified by Cells[2] in the code.

This is used for asp.net websites and webapplications, if it is a windows form application then you''ll probably need the row index of the datagrid to work with.
Other than that we need more info on your problem...please elaborate.


它的工作原理如下:
Combobox1.text = dataGridView1.SelectedRows [0] .Cells [0] .Value.ToString();
Combobox2.text = dataGridView1.SelectedRows [0] .Cells [1] .Value.ToString();
...
等等...
It works some what like this...
Combobox1.text = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
Combobox2.text = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();
...
and so on...


这篇关于从Datagridveiw到组合框的价值...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆