PC Review


Reply
Thread Tools Rate Thread

DataGridView - add items

 
 
=?Utf-8?B?Q2hyaXN0aWFuIEhhdmVs?=
Guest
Posts: n/a
 
      14th Nov 2007
Hi,

I have an DataGridView control with the following columns (added using the
designer):
column1 - DataGridViewTextBoxColumn
column2 - DataGridViewComboBoxColumn (values "test1", "test2")
column3 - DataGridViewCheckBoxColumn

How can I add a row, that the item "test2" is selected ("column2")?
How can I set a cell to readonly?

Christian

 
Reply With Quote
 
 
 
 
aplocher@gmail.com
Guest
Posts: n/a
 
      14th Nov 2007
On Nov 14, 11:45 am, Christian Havel
<ChristianHa...@discussions.microsoft.com> wrote:
> Hi,
>
> I have an DataGridView control with the following columns (added using the
> designer):
> column1 - DataGridViewTextBoxColumn
> column2 - DataGridViewComboBoxColumn (values "test1", "test2")
> column3 - DataGridViewCheckBoxColumn
>
> How can I add a row, that the item "test2" is selected ("column2")?
> How can I set a cell to readonly?
>
> Christian


I haven't used a DataGridView in quite some time but if I'm not
mistaken, setting a cell as ReadOnly is done by doing something like:

dgv.Rows[0].Cells[0].ReadOnly = true; // set first cell of first row
to readonly

I believe the combobox column can be set by changing the Cells.Value
property

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database column mapping - draw lines between items in DataGridView Microsoft Dot NET Framework Forms 2 10th Feb 2010 08:01 AM
Filter DataGridView as items are selected in CheckBoxList Alex Microsoft Dot NET Framework Forms 0 19th Jun 2008 04:35 PM
Problem doing multiple items drag and drop with 2 datagridView con =?Utf-8?B?UHVjY2E=?= Microsoft C# .NET 0 25th Apr 2007 01:40 AM
DataGridView (.NET 2.0 Windows Forms) Text wrapping in DataGridView Items Chris Hayes Microsoft Dot NET Framework 1 27th Aug 2006 06:07 PM
Display items in DataGridView like in the 'windows search' OS538DAV Microsoft Dot NET Framework Forms 0 27th Jul 2006 02:36 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:44 AM.