| 发表于:2007-08-28 11:01:42 楼主 |
winform中,combobox绑定到dataview中的一列(绑定没问题),在程序中想通过选择的项获得当前项的值。 dim id as integer ... id=cint(me.combobox1.selectedvalue.tostring) (错误提示:从字符串“system.data.datarowview”到类型“integer”的转换无效) 尝试了定义一个datarowview的对象来获取值,再把datarowview对象中的列的值提取出来,但也出现错误: dim objdatarowview as datarowview objdatarowview = ctype(me.combobox1.selectedvalue, datarowview)(错误提示:无法将类型为“system.int32”的对象强制转换为类型“system.data.datarowview”) //调试时用一个label显示值: label1.text=me.combox1.selectedvalue.tostring能正确得到combobox1的valuemember值。 请问如何才能引用到combobox中的valuemember值? |
|
|
|
|