Error message from error provider when I don't select an item

  • Thread starter Thread starter Vanessa
  • Start date Start date
V

Vanessa

Hi all!

I am creating a class to databing to a form. My difficulty is with combobox.
I have a field that is related to the customer table, where the customer ID
is an integer and I show its name in the combobox. In the class I have a
property of the type int to catch the ID. Everything works fine if I select
an item in the combobox, however if I don't select an item, the error
provider shows the following message:

"Object of type 'System.DBNull' cannot be converted to type 'System.Int32'"

Does someone has an idea how can I do to no have this message?

sds,
Vanessa
 
Vanessa said:
Hi all!

I am creating a class to databing to a form. My difficulty is with
combobox. I have a field that is related to the customer table, where
the customer ID is an integer and I show its name in the combobox. In
the class I have a property of the type int to catch the ID.
Everything works fine if I select an item in the combobox, however if
I don't select an item, the error provider shows the following
message:

"Object of type 'System.DBNull' cannot be converted to type
'System.Int32'"

Does someone has an idea how can I do to no have this message?
 
Back
Top