Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 2005 > C# 2005
|
C# 2005 For discussion of Visual C# 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 2005 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 June 20th, 2006, 03:28 AM
Registered User
 
Join Date: Jun 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataGridViewComboBoxColumn

Hello Gurus.

How do I set a default value in the comboboxcolumn? I want the user to see the default value "Normal".

Here is my code:

DataGridViewComboBoxColumn myCom = new DataGridViewComboBoxColumn();
     myCom.HeaderText = "Priority";
     myCom.DataPropertyName = "Priority";
     myCom.Items.Add("Normal");
     myCom.Items.Add("Urgent");

Thanks!



 
Old June 22nd, 2006, 01:48 PM
Registered User
 
Join Date: Jun 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

 DataGridViewComboBoxColumn myCom = new DataGridViewComboBoxColumn();
  myCom.DefaultCellStyle.NullValue = "Normal";
  myCom.HeaderText = "Priority";
  myCom.DataPropertyName = "Priority";
  myCom.Items.Add("Normal");
  myCom.Items.Add("Urgent");
  Grid1.Columns.Add(myCom);

Use the defaultCellStyle.NullValue

 
Old June 23rd, 2006, 07:17 AM
Registered User
 
Join Date: Jun 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks mate!






Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGridViewComboBoxColumn Jamil.Anwar C# 2005 0 January 11th, 2008 06:22 AM
VS2005 DataGridViewComboBoxColumn databound CloudDust Visual Basic 2005 Basics 4 October 12th, 2006 06:29 PM
DataGridViewComboBoxColumn bmains Pro Visual Basic 2005 0 January 5th, 2006 12:30 PM





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