我在运行Visual Studio 2015年如何动态地更改复选框检查状态
我试图动态地改变使用Me.Controls...CheckState = CheckState.Unchecked
动态创建的复选框的CheckState属性的社区版本,但我得到一个编译时错误,说CheckState不是控件的成员。
我在下面显示了用于创建复选框的代码,在底部显示了我试图用来更改值的代码。我会很感激任何建议。
cbPDF.Location = New Point(710, tvposition)
cbPDF.Size = New Size(80, 20)
cbPDF.Name = "cbPDF" + panposition.ToString
cbPDF.Text = "PDF Conv"
cbPDF.CheckState = CheckState.Unchecked
Controls.Add(cbPDF)
AddHandler cbPDF.CheckedChanged, AddressOf Me.CommonCheck
arrTextVals(10, panposition) = "cbPDF" + panposition.ToString
arrTextVals(11, panposition) = "unchecked"
If arrTextVals(11, bottomLine) = "unchecked" Then
Me.Controls(arrTextVals(10, bottomLine)).CheckState = CheckState.Unchecked
Else
Me.Controls(arrTextVals(10, bottomLine)).CheckState = CheckState.Checked
End If
控制是基类,像它说,它没有该成员。将其转换为CheckBox然后调用它。 – OneFineDay