Solved

Delete selection from a combobox

Posted on 2011-03-02
4
1,028 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 500 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

617 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