问题描述
我想将字符串转换为toolstripcombobox控件
i有一个字符串checked_module_name,这是一个名为toolstripcombobox控件
我需要通过它的名称来访问这个控件,但是从字符串
来修改它的selectedindex
ToolStripComboBox x = this.Controls [checked_module_name]作为ToolStripComboBox ;
给我一个错误无法通过引用转换,装箱转换将类型'System.Windows.Forms.Control'转换为'System.Windows.Forms.ToolStripComboBox'取消装箱转换,包装转换或空类型转换
i want to cast string to toolstripcombobox control
i have a string checked_module_name and this is a name of toolstripcombobox control
and i need to access this control by it's name but from the string
to modify it's selectedindex
ToolStripComboBox x = this.Controls[checked_module_name] as ToolStripComboBox;
give me an error Cannot convert type 'System.Windows.Forms.Control' to 'System.Windows.Forms.ToolStripComboBox' via a reference conversion, boxing conversion, unboxing conversion, wrapping conversion, or null type conversion
推荐答案
这篇关于我想将字符串转换为toolstripcombobox控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!