如何从数据网格视图的选定行中获取值到组合框? [英] how to get the values from the selected row of a datagrid view into a combobox?

查看:89
本文介绍了如何从数据网格视图的选定行中获取值到组合框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在vb.net上工作....我有一个datagridview(客户),其中包含客户详细信息,例如电话号码,地址,公司等?我想将所选行的值分别输入到文本框和组合框....我已经能够将值输入到文本框而不是组合框..... !!!

Pleaseee很快就帮助.. !!!!

在此先谢谢您:) :):

i am working on vb.net.... i have a datagridview (Customers) which contains the customer details such as phone number, address, company etc?? i want to get the values of the selected row into the textboxes and comboboxes respectively.... i have been able to get values into the textboxes but not into the comboboxes..... !!!

Pleaseee Help sooon..!!!!

Thanks In advance :) :)

推荐答案

textobx.text=Datagridview1.selectedItem.cells(0).text


此处的"0"代表所选记录的列.


Here ''0'' represents the column of the selected record.


dim Value as string = Datagridview1.selectedItem.cells(0).text
Combobox1.items.add(Value)



阅读此内容以获取更多信息
如何:从Windows窗体ComboBox,ListBox或CheckedListBox添加和删除项目控制 [ ^ ]



Have a read of this for more information
How to: Add and Remove Items from a Windows Forms ComboBox, ListBox, or CheckedListBox Control[^]


i = datagridview1.CurrentRow.Index

 Combobox1.Text = datagridview1.Item(3,i).Value


这篇关于如何从数据网格视图的选定行中获取值到组合框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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