如何更改表单中某种类型的子控件的属性? [英] How do I change the property of one type of Child Controls in a form?
本文介绍了如何更改表单中某种类型的子控件的属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一个短代码。
对于每个项目作为DomainUpDown在GroupBox1.Controls
item.Value = 0
Next
但显示错误,Value不是'System.Windows.Forms.DomainUpDown'的成员。
帮助!
解决方案
DomainUpDown 没有任何属性,如 Value
这个控件的功能与 ComboBox
相同。
item.Text =0
您可以分配的多个属性Dim iIndex As Integer = 0
item.SelectedIndex = iIndex // SelectedIndex将具有整数类型值
item.SelectedItem =0// SelectedItem将具有对象类型值
In a VB WindowsForms Application,
I want to change the value of many DomainUpDown controls which are inside a GroupBox Control or a Panel.
I though of a short code.
For Each item As DomainUpDown In GroupBox1.Controls
item.Value = 0
Next
But Shows me error, "Value' is not a member of 'System.Windows.Forms.DomainUpDown'.
Help!
解决方案
DomainUpDown doesn't have any property like Value
This control will perform same as ComboBox
. There are several property that you can assign to change the value.
item.Text = "0"
Dim iIndex As Integer = 0
item.SelectedIndex = iIndex //SelectedIndex will have integer type value
item.SelectedItem = "0" //SelectedItem will have object type value
这篇关于如何更改表单中某种类型的子控件的属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文