开发者

How do I migrate CanPropertyChange("Text") from VB6 to VB.NET?

I want to upgrade 开发者_如何学Goan ActiveX control from VB6 to VB.NET. I'm having trouble upgrading this code:

If CanPropertyChange("Text") Then
    Text1.Text = Value
    RaiseEvent TextChange()
End If

I get the error: "Name 'CanPropertyChange' is not declared."


VB.Net does not support anything similar to the CanPropertyChange("Text") method. The easiest way around this is to do the assignment within a Try...Catch block.

Try
  Text1.Text = Value
  RaiseEvent TextChange()
Catch ex As Exception

End Try

If the property cannot be written to an exception will be thrown which you can access in the Catch block.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜