Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2006, 10:18 AM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Displaying null value in a typical combobox - C#

Folks,

  I have a very simple problem, I have a ComboBox bound to a datasource (ArrayList) The ArrayList does not contain an entry for a null value, but null is a perfectly valid value. I would like to know if there is anyway to have the combobox display nothing on start up. Currently it is throwing an exception.

  Yes, I could add a record with null value to the ArrayList, but is not the desired solution. I am using the ArrayList to populate a combobox in one form a datagridviewcombobox in another form. dgvcombobox handles this well with NullValue and DataSourceNullValue methods, is there something I am missing with a combobox?

 
Old August 24th, 2006, 12:47 AM
2V. 2V. is offline
Authorized User
 
Join Date: Aug 2006
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey, you can look for null values and if you find it replace with 0 or " ".
Other exit:
try { ... } catch(/*YourExceptionOfNullValue*/)
{
//
//replace null value with value that you need.
//
}







Similar Threads
Thread Thread Starter Forum Replies Last Post
Typical Algorithm rajanikrishna ASP.NET 1.0 and 1.1 Professional 0 November 20th, 2006 03:05 AM
ASP page not displaying null values imercha Classic ASP Basics 1 January 19th, 2006 02:38 AM
How to set Not Null constraint to Null Columns arasu Oracle 1 August 22nd, 2005 10:09 AM
typical logic rajanikrishna Classic ASP Basics 2 June 11th, 2004 11:15 PM
A Typical Book Class Maxood ASP.NET 1.0 and 1.1 Basics 8 March 23rd, 2004 04:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.