Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Where did my exception go?

Status
Not open for further replies.

dragonwell

Programmer
Joined
Oct 21, 2002
Messages
863
Location
US
I am binding an editable DataGrid to an ArrayList. The objects in the ArrayList are of a class in my program which has this property
Code:
Public Property Capacity() As Integer
  Get
    Return Me._capacity
  End Get
  Set(ByVal value As Integer)
    If value < 0 Then
        Throw New ApplicationException("Capacity must be more than 0.")
    End If
    Me._capacity = value
  End Set
End Property

If I edit the Capacity column in my DataGrid, and enter a value less than 0, I am expecting the exception to be thrown. It is getting thrown - but who is handling it? All that happens is the value is not set. In fact, if I enter a non-integer string, the same thing happens - I guess the question is "where is the value of what is entered into a DataGrid validated?"

I would like to be able to inform the user of this business rule while they edit the object in the DataGrid, not simply reject their values.

Thanks for you help!
 
I don't know! I have bound the objects to rows in the DataGrid. When the cells in the DataGrid are edited, the property is set - but not by any code that I wrote.

[pipe]
Share your knowledge! -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top