Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Delete selection from a combobox

Posted on 2011-03-02
4
Medium Priority
?
1,033 Views
Last Modified: 2012-05-11
Can't believe I cannot figure this one out...

I have a datagridview that has a combobox that is linked to a data table.  The list is populated very nicely, but I cannot delete the entry if I choose the incorrect item (I can change the item picked, but there might be times when this field is left blank).  I'm guessing this is a property setting of the combobox, but I cannot seem to find the right one.
0
Comment
Question by:bhlabelle
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 13

Accepted Solution

by:
gamarrojgq earned 2000 total points
ID: 35021381
Hi,

If your combobox datasource is a table that do not have a blank value, that is the reason why it does not let you select a blank value.

You can add a value that represents blank such <Not Selected> to your combobox so the users can select that one, or you just add an empty value to match the blank.

Hope that helps
0
 

Author Comment

by:bhlabelle
ID: 35026758
How do I add an empty value to the combobox?  I assume it would be when the form loads, but I'm not sure how to do this.
0
 
LVL 13

Expert Comment

by:gamarrojgq
ID: 35028220
well, if you have a datatable as the datasource of your combobox you can do it like this, assuming your Table just have one Field

Dim drEmptyRow as DataRow

drEmptyRow = YourDataTable.NewRow
drEmptyRow("FieldName") = ""
YourDataTable.Rows.Add(drEmptyRow)

this code has to be just before you set the ComboBox Datasource
0
 

Author Closing Comment

by:bhlabelle
ID: 35028599
Well I do not know how/where to add the code to insert the blank line, so I will add an entry in my Access DB instead.  Thanks for your help.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question