473,320 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

DataGridViewComboBox


I have bound a dgvcombobox to a datasource/table/column value set. I would
like to be able to include a NULL value in the pick list the combo box
shows, but it seems that once I've clicked in the combo box, there's no way
to assign a NULL value in the DataGridView for that column.

--

"I have nothing but the greatest respect for other peoples' crackpot
beliefs".
-- Sam the Eagle.

Mar 14 '06 #1
6 6120
John wrote:
I have bound a dgvcombobox to a datasource/table/column value set. I would
like to be able to include a NULL value in the pick list the combo box
shows, but it seems that once I've clicked in the combo box, there's no way
to assign a NULL value in the DataGridView for that column.


Why don't you insert the Null to the datasource/table/column before
binding it?

Chris
Mar 14 '06 #2
Hello John,

Set combobox.Text="".

J> I have bound a dgvcombobox to a datasource/table/column value set. I
J> would like to be able to include a NULL value in the pick list the
J> combo box shows, but it seems that once I've clicked in the combo
J> box, there's no way to assign a NULL value in the DataGridView for
J> that column.
J>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Mar 14 '06 #3
Michael Nemtsev wrote:
Hello John,

Set combobox.Text="".

J> I have bound a dgvcombobox to a datasource/table/column value set. I
J> would like to be able to include a NULL value in the pick list the
J> combo box shows, but it seems that once I've clicked in the combo
J> box, there's no way to assign a NULL value in the DataGridView for
J> that column.
J> ---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do
not cease to be insipid." (c) Friedrich Nietzsche


Don't think that solves the issue:

"I would like to be able to include a NULL value in the pick list the"
Mar 14 '06 #4
If you populate the datasource with a select, you can insert the Null value
using an union. For example

SELECT
null AS CustomerID,
'(none)' AS CustumerName
FROM
Customers
UNION
SELECT
CustomerID,
CustomerName
FROM
Customers;

"Chris" <no@spam.com> escribió en el mensaje
news:uy**************@TK2MSFTNGP09.phx.gbl...
John wrote:
I have bound a dgvcombobox to a datasource/table/column value set. I
would like to be able to include a NULL value in the pick list the combo
box shows, but it seems that once I've clicked in the combo box, there's
no way to assign a NULL value in the DataGridView for that column.


Why don't you insert the Null to the datasource/table/column before
binding it?

Chris

Mar 14 '06 #5

"Chris" <no@spam.com> wrote in message
news:uy**************@TK2MSFTNGP09.phx.gbl...
John wrote:
I have bound a dgvcombobox to a datasource/table/column value set. I
would like to be able to include a NULL value in the pick list the combo
box shows, but it seems that once I've clicked in the combo box, there's
no way to assign a NULL value in the DataGridView for that column.


Why don't you insert the Null to the datasource/table/column before
binding it?


I'll give it a try. I was just hoping there was a "AllowNull" setting on the
control that would allow it to work without me having to do that :)
Mar 14 '06 #6

"Alex Bibiano" <ab******@nikel.es> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
If you populate the datasource with a select, you can insert the Null
value using an union. For example

SELECT
null AS CustomerID,
'(none)' AS CustumerName
FROM
Customers
UNION
SELECT
CustomerID,
CustomerName
FROM
Customers;

This works nicely, thanks.

Mar 15 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: dimension | last post by:
Hi, i have one question and one opinion i seek. please assist if you can. I am using VS2005 beta. 1) I have two tables with the following columns Security: security_id, name, symbol, exchange_id...
1
by: perspolis | last post by:
Hi All I used datagridviewcombostyle for my application.. but it shows the combobox style in DropDownList style..I want to be able to enter data into it,,how can I have combobox dropdown ?? ...
1
by: ashok76 | last post by:
Hi I've a DataGridView and where has column 0 is a DataGridViewComboBoxColumn Whenever I selected that cell then the drop down list not appeared on single click event hence I need to click again...
1
by: tim8w via DotNetMonster.com | last post by:
I am using a DataGridViewComboBox in a DataGridView. When a user selects a radio button, I would like to clear all the items in the DataGridViewComboBox and repopulate with new values. I do this as...
0
by: DominicHelen | last post by:
I am doing c# .net windows application. I have three forms which are load one by one using : Thread t = new Thread(new ThreadStart(StartInterviewThread)); t.start(); public void...
3
by: DominicHelen | last post by:
I have used this following: private void EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e) { DataGridViewComboBoxEditingControl cbo = e.Control as...
0
by: DominicHelen | last post by:
I have a datagridviewcomboboxcolumn with that I can type a new value which is not in the drop down list. But I can not type a value which is in the list with keyboard. I can only scroll down to...
0
by: gotonagle | last post by:
Hi i am working in vb.net with datagridview. the problem is if i set the EditMode property of datagrid to "EditOnKeyStrokeOrF2" then to select the dropdown we have to click three times on it and if...
2
by: arevans | last post by:
I have a datagridview with two comboboxcolumns. I want the combobox in column B to be dynamically filled with data from the database depending on which item is selected in column A. How do I go...
1
Plater
by: Plater | last post by:
I feel like this question has been asked before, but I couldn't find it. I think I am missing something obvious. Basically I am going to have a DataGridView with two columns. One textbox, one...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.