我们如何使用C#.net在datagridview组合框列中获取值 [英] how we fetch values in datagridview combo box column using C#.net

查看:98
本文介绍了我们如何使用C#.net在datagridview组合框列中获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在使用C#.net开发Windows应用程序..我有一个datagridview和两个datagridviewcombox列(即Country和State).在这里,我想根据Country Column中选择的国家/地区加载状态值. .


我尝试了CellEndEvent,但它也会更改以前的行状态值..so,请帮助我..

在此先感谢..

hi guys,

am developing windows application using C#.net..In that i have one datagridview with two datagridviewcombox column(i.e Country and State)..here i want to load state value based on country selected in Country Column..i need Solution for this..


i tried CellEndEvent but it change previous row state values also ..so please help me out of this guys..

thanks in advance..

推荐答案

亲爱的朋友,

您必须编写组合框选择的索引已更改事件,更改后可以获取国家/地区的ID,然后可以从中获取该国家/地区的相应州并相应地填充状态组合框.

请参考:- http://msdn.microsoft.com/en -us/library/system.windows.forms.combobox.selectedindexchanged.aspx [
Dear Friend,

You have to write the combobox selected index changed event on the change of which you can get the ID of the country and from there you can fetch the corresponding states of that country and fill the combo box of states accordingly.

Please refer this:-http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.selectedindexchanged.aspx[^]

I hope this will help you out.

Thanks


您好,

您可以在combobox1_SelectedIndexChanged事件上绑定第二个组合框.
查看此链接,

http://social.msdn.microsoft.com /Forums/zh-CN/winformsdatacontrols/thread/783baae3-9733-4f81-8974-6fccb8e6b5aa/ [
Hi,

You can bind the second combobox on combobox1_SelectedIndexChanged event.
check out this link,

http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/783baae3-9733-4f81-8974-6fccb8e6b5aa/[^]

Hope this helps.


这篇关于我们如何使用C#.net在datagridview组合框列中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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