类型“System.Windows.Forms.DataGridViewCell”的值无法转换为“System.Windows.Forms.Control”
lmhcs 2011-02-20 06:08:11 我写了一个控件,有个属性给用户传入要操作的控件。
Friend Property CPControl() As Control
Get
Return _PControl
End Get
Set(ByVal value As Control)
_PControl = value
If TypeOf value Is TextBox Then
mTextbox = Nothing
mTextbox = CType(value, TextBox)
' ElseIf TypeOf value Is DataGridViewCell Then
End If
End Set
End Property
结果我发现,当要传入的控件是datagridviewcell时,系统提示
类型“System.Windows.Forms.DataGridViewCell”的值无法转换为“System.Windows.Forms.Control”
我该怎么更改属性的类型的才能传入DataGridViewCell 或者文本框等基于control的控件呢 。