473,395 Members | 1,761 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,395 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 6126
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.