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
Ben Voigt [C++ MVP] - 06 Mar 2008 22:26 GMT
> Hi all!
>
[quoted text clipped - 10 lines]
>
> Does someone has an idea how can I do to no have this message?
You could change the property to int? (That is Nullable<int>, not a
question)
> sds,
> Vanessa
Vanessa - 07 Mar 2008 11:49 GMT
Hi Ben!
Thank you very much! It worked like I wanted.
Vanessa
> > Hi all!
> >
[quoted text clipped - 16 lines]
> > sds,
> > Vanessa
Ben Voigt [C++ MVP] - 07 Mar 2008 14:14 GMT
> Hi Ben!
>
> Thank you very much! It worked like I wanted.
You're welcome.
> Vanessa
>
[quoted text clipped - 18 lines]
>>> sds,
>>> Vanessa