Error displaying information in listview


Author
Message
Michael Reese
Michael Reese
Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)Advanced StrataFrame User (533 reputation)
Group: StrataFrame Users
Posts: 235, Visits: 1.6K
I have a sf-form with a sflistview and sfcontrols. When I load the form, I get the errror below?? Some of the columns are intenionally null.

------------------------------------------------------------

Conversion from type 'DBNull' to type 'Integer' is not valid.

-------------------------------------------------------------

System.InvalidCastException was unhandled by user code
  Message="Conversion from type 'DBNull' to type 'Integer' is not valid."
  Source="Microsoft.VisualBasic"
  StackTrace:
       at Microsoft.VisualBasic.CompilerServices.Conversions.ToInteger(Object Value)
       at ORION_BO.BOVendorContacts.get_PositionTitle() in N:\Development\Orion\ORION_BO\ORION_BO\Vendor\BOVendorContacts.designer.vb:line 428
       at ORION_BO.BOVendorContacts.Field_PositionTitle_Descriptor.GetValue(Object component) in N:\Development\Orion\ORION_BO\ORION_BO\Vendor\BOVendorContacts.designer.vb:line 1234
       at System.Windows.Forms.BindToObject.GetValue()
       at System.Windows.Forms.Binding.PushData(Boolean force)

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
This is proper behavior.  If you have NULL fields you have to address them.  You can do this a number of different ways.  You can use the NULL options in the field customization within the BO Mapper or you can populate the column in the ListView using the PopulatedThroughEvent and handle the column population within the RowPopulating event.  You can then test on the NULL value and provide whatever value you would like for a NULL value.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search