• 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
0
DoronAviad
Asked:
DoronAviad
2 Solutions
 
käµfm³d 👽Commented:
Use String.Empty instead of Nothing.
0
 
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
                                        ).Distinct.Union(String.Empty)

Open in new window


Any Idea ?
0
 
CodeCruiserCommented:
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.
0
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