Z
ZorpiedoMan
I just ran across an interesting phenon...
If you bind a control, say a textbox, to a class.property, and in
changing the value of the textbox an error is thrown in the
class.property, you get stuck in the textbox and cannot leave:
Public Class XClass
Private myName as String
Public Property Name as String
Get
Return myName
End Get
Set (Value as String)
if Value = "Bob" Then
Throw New Exception("Name Cannot Be Bob")
Else
myName = value
End If
End Property
---------------- On the form, you have a textbox (textbox1)
-------------
Private myXClass as New Xclass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.DataBindings.Add New Binding("Text", myXClass, "Name")
End Sub
-------------------------------
So, if you change the textbox from "Mary" to "Bob", the exception seems
to get thrown, but I can't figure out how to catch it.
Any ideas?
--Zorpy
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
If you bind a control, say a textbox, to a class.property, and in
changing the value of the textbox an error is thrown in the
class.property, you get stuck in the textbox and cannot leave:
Public Class XClass
Private myName as String
Public Property Name as String
Get
Return myName
End Get
Set (Value as String)
if Value = "Bob" Then
Throw New Exception("Name Cannot Be Bob")
Else
myName = value
End If
End Property
---------------- On the form, you have a textbox (textbox1)
-------------
Private myXClass as New Xclass
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
TextBox1.DataBindings.Add New Binding("Text", myXClass, "Name")
End Sub
-------------------------------
So, if you change the textbox from "Mary" to "Bob", the exception seems
to get thrown, but I can't figure out how to catch it.
Any ideas?
--Zorpy
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!