• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 737
  • Last Modified:

Add Null Value to ComboBox vb.net

I need to display combobox bound to data field that can be null
I have a LINQ query that return a list on Items to display

How can I add to this list a Null value so in case I display a row with null value in that bound filed I wound get error message

And to let users select null value incase thay don't want any value in that field
2 Solutions
käµfm³d 👽Commented:
Use String.Empty instead of Nothing.
DoronAviadCEOAuthor Commented:
I have a LINQ query that returns a list of strings
I am tryind to Union with the String.Empy with no success
                            Dim qtype = (From a In cn.ContactsTels
                                         Order By a.Type
                                        Select a.Type

Open in new window

Any Idea ?
Instead of setting the data source of the list, add the empty item to the list manually and then loop through the LINQ query and add rest of the items.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now